Skip to content

Commit 7cbc518

Browse files
bhparijatprameshj
authored andcommitted
Added ui for setting tenant-id (#6850)
1 parent 91520af commit 7cbc518

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

packages/auth/demo/public/index.html

+12
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,18 @@
229229
</button>
230230
</form>
231231

232+
<!-- Set Tenant -->
233+
<div class="group">Set Tenant</div>
234+
<form class="form form-bordered no-submit">
235+
<input type="text" id="set-tenant"
236+
class="form-control"
237+
placeholder="Tenant" />
238+
<button class="btn btn-block btn-primary"
239+
id="set-tenant-btn">
240+
Set Tenant
241+
</button>
242+
</form>
243+
232244
<!-- Sign up -->
233245
<div class="group">Sign Up</div>
234246
<form class="form form-bordered no-submit">

packages/auth/demo/src/index.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,14 @@ function onUseDeviceLanguage() {
321321
$('#language-code').val(auth.languageCode);
322322
alertSuccess('Using device language "' + auth.languageCode + '".');
323323
}
324-
324+
/**
325+
* Set tenant id for the firebase project.
326+
*/
327+
function onSetTenantIdClick(_event) {
328+
const tenantId = $('#set-tenant').val();
329+
auth.tenantId = tenantId === '' ? null : tenantId;
330+
alertSuccess('Tenant Id : ' + auth.tenantId);
331+
}
325332
/**
326333
* Changes the Auth state persistence to the specified one.
327334
*/
@@ -2093,6 +2100,8 @@ function initApp() {
20932100
$('#enroll-mfa-totp-start').click(onStartEnrollWithTotpMultiFactor);
20942101
// Completes multi-factor enrollment with supplied OTP(One-Time Password).
20952102
$('#enroll-mfa-totp-finalize').click(onFinalizeEnrollWithTotpMultiFactor);
2103+
// Sets tenant for the current auth instance
2104+
$('#set-tenant-btn').click(onSetTenantIdClick);
20962105
}
20972106

20982107
$(initApp);

0 commit comments

Comments
 (0)