1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 00:03:56 +00:00

Increase popup width on linux during WebAuthn process (#1772)

* Expand popup width on linux during WebAuthn prompt

* Refactor
This commit is contained in:
Oscar Hinton
2021-04-06 23:10:22 +02:00
committed by GitHub
parent 0a2f738634
commit eeb61b019b
3 changed files with 34 additions and 1 deletions

View File

@@ -74,6 +74,12 @@ export class TwoFactorComponent extends BaseTwoFactorComponent {
return;
}
// WebAuthn prompt appears inside the popup on linux, and requires a larger popup width
// than usual to avoid cutting off the dialog.
if (this.selectedProviderType === TwoFactorProviderType.WebAuthn && await this.isLinux()) {
document.body.classList.add('linux-webauthn');
}
if (this.selectedProviderType === TwoFactorProviderType.Email &&
this.popupUtilsService.inPopup(window)) {
const confirmed = await this.platformUtilsService.showDialog(this.i18nService.t('popup2faCloseMessage'),
@@ -98,12 +104,20 @@ export class TwoFactorComponent extends BaseTwoFactorComponent {
});
}
ngOnDestroy() {
async ngOnDestroy() {
this.broadcasterService.unsubscribe(BroadcasterSubscriptionId);
if (this.selectedProviderType === TwoFactorProviderType.WebAuthn && await this.isLinux()) {
document.body.classList.remove('linux-webauthn');
}
super.ngOnDestroy();
}
anotherMethod() {
this.router.navigate(['2fa-options']);
}
async isLinux() {
return (await BrowserApi.getPlatformInfo()).os === "linux";
}
}