1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-06 00:13:28 +00:00

fix(UIRefresh-Extension-Duo-2FA): [Auth/PM-18901] Adjust determineDuoLaunchAction logic to consider if already in popout (#13712)

This commit is contained in:
Jared Snider
2025-03-06 10:45:46 -05:00
committed by GitHub
parent ba0d1f27bd
commit 6f4a1ea37f
2 changed files with 16 additions and 1 deletions

View File

@@ -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,
);
});
});
});

View File

@@ -106,7 +106,9 @@ export class ExtensionTwoFactorAuthComponentService
AuthPopoutType.twoFactorAuthDuo,
);
if (inTwoFactorAuthDuoPopout) {
const inPopout = BrowserPopupUtils.inPopout(this.window);
if (inTwoFactorAuthDuoPopout || inPopout) {
return DuoLaunchAction.DIRECT_LAUNCH;
}