diff --git a/apps/browser/src/auth/services/extension-two-factor-auth-component.service.ts b/apps/browser/src/auth/services/extension-two-factor-auth-component.service.ts index 03d76dd47fa..f7317c3200b 100644 --- a/apps/browser/src/auth/services/extension-two-factor-auth-component.service.ts +++ b/apps/browser/src/auth/services/extension-two-factor-auth-component.service.ts @@ -9,7 +9,8 @@ import BrowserPopupUtils from "../../platform/popup/browser-popup-utils"; import { AuthPopoutType, closeSsoAuthResultPopout, - closeTwoFactorAuthPopout, + closeTwoFactorAuthEmailPopout, + closeTwoFactorAuthWebAuthnPopout, } from "../popup/utils/auth-popout-window"; export class ExtensionTwoFactorAuthComponentService @@ -67,13 +68,24 @@ export class ExtensionTwoFactorAuthComponentService return; } - const inTwoFactorAuthPopout = BrowserPopupUtils.inSingleActionPopout( + const inTwoFactorAuthWebAuthnPopout = BrowserPopupUtils.inSingleActionPopout( this.window, - AuthPopoutType.twoFactorAuth, + AuthPopoutType.twoFactorAuthWebAuthn, ); - if (inTwoFactorAuthPopout) { - await closeTwoFactorAuthPopout(); + if (inTwoFactorAuthWebAuthnPopout) { + await closeTwoFactorAuthWebAuthnPopout(); + return; + } + + const inTwoFactorAuthEmailPopout = BrowserPopupUtils.inSingleActionPopout( + this.window, + AuthPopoutType.twoFactorAuthEmail, + ); + + if (inTwoFactorAuthEmailPopout) { + await closeTwoFactorAuthEmailPopout(); + return; } } diff --git a/apps/browser/src/auth/services/extension-two-factor-auth-email-component.service.ts b/apps/browser/src/auth/services/extension-two-factor-auth-email-component.service.ts index 10d203d3a84..f09b7a147fd 100644 --- a/apps/browser/src/auth/services/extension-two-factor-auth-email-component.service.ts +++ b/apps/browser/src/auth/services/extension-two-factor-auth-email-component.service.ts @@ -4,6 +4,7 @@ import { } from "@bitwarden/auth/angular"; import { DialogService } from "@bitwarden/components"; +import { openTwoFactorAuthEmailPopout } from "../../auth/popup/utils/auth-popout-window"; import BrowserPopupUtils from "../../platform/popup/browser-popup-utils"; // TODO: popup state persistence should eventually remove the need for this service @@ -26,7 +27,7 @@ export class ExtensionTwoFactorAuthEmailComponentService type: "warning", }); if (confirmed) { - await BrowserPopupUtils.openCurrentPagePopout(this.window); + await openTwoFactorAuthEmailPopout(); } } }