Skip to content

Add set tenant method to demo app #6850

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions packages/auth/demo/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,18 @@
</button>
</form>

<!-- Set Tenant -->
<div class="group">Set Tenant</div>
<form class="form form-bordered no-submit">
<input type="text" id="set-tenant"
class="form-control"
placeholder="Tenant" />
<button class="btn btn-block btn-primary"
id="set-tenant-btn">
Set Tenant
</button>
</form>

<!-- Sign up -->
<div class="group">Sign Up</div>
<form class="form form-bordered no-submit">
Expand Down
11 changes: 10 additions & 1 deletion packages/auth/demo/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,14 @@ function onUseDeviceLanguage() {
$('#language-code').val(auth.languageCode);
alertSuccess('Using device language "' + auth.languageCode + '".');
}

/**
* Set tenant id for the firebase project.
*/
function onSetTenantIdClick(_event) {
const tenantId = $('#set-tenant').val();
auth.tenantId = tenantId === '' ? null : tenantId;
alertSuccess('Tenant Id : ' + auth.tenantId);
}
/**
* Changes the Auth state persistence to the specified one.
*/
Expand Down Expand Up @@ -2032,6 +2039,8 @@ function initApp() {
$('#enroll-mfa-totp-start').click(onStartEnrollWithTotpMultiFactor);
// Completes multi-factor enrollment with supplied OTP(One-Time Password).
$('#enroll-mfa-totp-finalize').click(onFinalizeEnrollWithTotpMultiFactor);
// Sets tenant for the current auth instance
$('#set-tenant-btn').click(onSetTenantIdClick);
}

$(initApp);