diff --git a/apps/browser/src/auth/services/extension-two-factor-auth-component.service.spec.ts b/apps/browser/src/auth/services/extension-two-factor-auth-component.service.spec.ts index 408bb5b0ca4..2247328acab 100644 --- a/apps/browser/src/auth/services/extension-two-factor-auth-component.service.spec.ts +++ b/apps/browser/src/auth/services/extension-two-factor-auth-component.service.spec.ts @@ -15,6 +15,7 @@ jest.mock("../popup/utils/auth-popout-window", () => { jest.mock("../../platform/popup/browser-popup-utils", () => ({ inSingleActionPopout: jest.fn(), + inPopout: jest.fn(), })); import { DuoLaunchAction } from "@bitwarden/auth/angular"; @@ -173,6 +174,8 @@ describe("ExtensionTwoFactorAuthComponentService", () => { return key === AuthPopoutType.twoFactorAuthDuo; }); + jest.spyOn(BrowserPopupUtils, "inPopout").mockImplementation(() => false); + expect(extensionTwoFactorAuthComponentService.determineDuoLaunchAction()).toBe( DuoLaunchAction.DIRECT_LAUNCH, ); @@ -180,10 +183,20 @@ describe("ExtensionTwoFactorAuthComponentService", () => { it("should return SINGLE_ACTION_POPOUT if not in two factor auth duo popout", () => { jest.spyOn(BrowserPopupUtils, "inSingleActionPopout").mockImplementation(() => false); + jest.spyOn(BrowserPopupUtils, "inPopout").mockImplementation(() => false); expect(extensionTwoFactorAuthComponentService.determineDuoLaunchAction()).toBe( DuoLaunchAction.SINGLE_ACTION_POPOUT, ); }); + + it("should return DIRECT_LAUNCH if in popout", () => { + jest.spyOn(BrowserPopupUtils, "inSingleActionPopout").mockImplementation(() => false); + jest.spyOn(BrowserPopupUtils, "inPopout").mockImplementation(() => true); + + expect(extensionTwoFactorAuthComponentService.determineDuoLaunchAction()).toBe( + DuoLaunchAction.DIRECT_LAUNCH, + ); + }); }); }); 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 c11baadb595..f768b223984 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 @@ -106,7 +106,9 @@ export class ExtensionTwoFactorAuthComponentService AuthPopoutType.twoFactorAuthDuo, ); - if (inTwoFactorAuthDuoPopout) { + const inPopout = BrowserPopupUtils.inPopout(this.window); + + if (inTwoFactorAuthDuoPopout || inPopout) { return DuoLaunchAction.DIRECT_LAUNCH; }