mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-23 11:56:00 +01:00
Update web sso content to indicate window OK to close (#720)
* Update web sso content to indicate window OK to close This is done after the authResult handoff message is delivered to the extension. It is not possible to close the window from javascript as closing a window is limited to the script that opened it. If we maintain a reference to the web window, it should be possible to subscribe to the authResult message and close the web windows from the browser. * Use i18n for close tab message * delete cookie after it is used Co-authored-by: Matt Gibson <mdgibson@Matts-MBP.lan>
This commit is contained in:
parent
2db1684b3c
commit
6b66f14319
@ -53,6 +53,9 @@ export class SsoComponent extends BaseSsoComponent {
|
||||
|
||||
async submit() {
|
||||
await this.storageService.save(IdentifierStorageKey, this.identifier);
|
||||
if (this.clientId === 'browser') {
|
||||
document.cookie = `ssoHandOffMessage=${this.i18nService.t('ssoHandOff')};SameSite=strict`
|
||||
}
|
||||
super.submit();
|
||||
}
|
||||
}
|
||||
|
@ -19,9 +19,11 @@
|
||||
<div class="mt-5 d-flex justify-content-center">
|
||||
<div>
|
||||
<img src="../images/logo-dark@2x.png" class="mb-4 logo" alt="Bitwarden">
|
||||
<p class="text-center">
|
||||
<i class="fa fa-spinner fa-spin fa-2x text-muted" title="Loading" aria-hidden="true"></i>
|
||||
</p>
|
||||
<div id="content">
|
||||
<p class="text-center">
|
||||
<i class="fa fa-spinner fa-spin fa-2x text-muted" title="Loading" aria-hidden="true"></i>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
@ -37,6 +37,10 @@ function getQsParam(name: string) {
|
||||
|
||||
function initiateBrowserSso(code: string, state: string) {
|
||||
window.postMessage({ command: 'authResult', code: code, state: state }, '*');
|
||||
let handOffMessage = ('; ' + document.cookie).split('; ssoHandOffMessage=').pop().split(';').shift();
|
||||
document.cookie = 'ssoHandOffMessage=;SameSite=strict;max-age=0'
|
||||
document.getElementById('content').innerHTML =
|
||||
`<p>${handOffMessage}</p>`;
|
||||
}
|
||||
|
||||
function extractFromRegex(s: string, regexString: string) {
|
||||
|
@ -3193,6 +3193,9 @@
|
||||
"enterpriseSingleSignOn": {
|
||||
"message": "Enterprise Single Sign-On"
|
||||
},
|
||||
"ssoHandOff": {
|
||||
"message": "You may now close this tab and continue in the extension."
|
||||
},
|
||||
"businessPortal": {
|
||||
"message": "Business Portal",
|
||||
"description": "The web portal used by business organizations for configuring certain features."
|
||||
|
Loading…
Reference in New Issue
Block a user