mirror of
https://github.com/bitwarden/browser
synced 2025-12-11 22:03:36 +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:
@@ -15,6 +15,7 @@ jest.mock("../popup/utils/auth-popout-window", () => {
|
|||||||
|
|
||||||
jest.mock("../../platform/popup/browser-popup-utils", () => ({
|
jest.mock("../../platform/popup/browser-popup-utils", () => ({
|
||||||
inSingleActionPopout: jest.fn(),
|
inSingleActionPopout: jest.fn(),
|
||||||
|
inPopout: jest.fn(),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
import { DuoLaunchAction } from "@bitwarden/auth/angular";
|
import { DuoLaunchAction } from "@bitwarden/auth/angular";
|
||||||
@@ -173,6 +174,8 @@ describe("ExtensionTwoFactorAuthComponentService", () => {
|
|||||||
return key === AuthPopoutType.twoFactorAuthDuo;
|
return key === AuthPopoutType.twoFactorAuthDuo;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
jest.spyOn(BrowserPopupUtils, "inPopout").mockImplementation(() => false);
|
||||||
|
|
||||||
expect(extensionTwoFactorAuthComponentService.determineDuoLaunchAction()).toBe(
|
expect(extensionTwoFactorAuthComponentService.determineDuoLaunchAction()).toBe(
|
||||||
DuoLaunchAction.DIRECT_LAUNCH,
|
DuoLaunchAction.DIRECT_LAUNCH,
|
||||||
);
|
);
|
||||||
@@ -180,10 +183,20 @@ describe("ExtensionTwoFactorAuthComponentService", () => {
|
|||||||
|
|
||||||
it("should return SINGLE_ACTION_POPOUT if not in two factor auth duo popout", () => {
|
it("should return SINGLE_ACTION_POPOUT if not in two factor auth duo popout", () => {
|
||||||
jest.spyOn(BrowserPopupUtils, "inSingleActionPopout").mockImplementation(() => false);
|
jest.spyOn(BrowserPopupUtils, "inSingleActionPopout").mockImplementation(() => false);
|
||||||
|
jest.spyOn(BrowserPopupUtils, "inPopout").mockImplementation(() => false);
|
||||||
|
|
||||||
expect(extensionTwoFactorAuthComponentService.determineDuoLaunchAction()).toBe(
|
expect(extensionTwoFactorAuthComponentService.determineDuoLaunchAction()).toBe(
|
||||||
DuoLaunchAction.SINGLE_ACTION_POPOUT,
|
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,
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -106,7 +106,9 @@ export class ExtensionTwoFactorAuthComponentService
|
|||||||
AuthPopoutType.twoFactorAuthDuo,
|
AuthPopoutType.twoFactorAuthDuo,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (inTwoFactorAuthDuoPopout) {
|
const inPopout = BrowserPopupUtils.inPopout(this.window);
|
||||||
|
|
||||||
|
if (inTwoFactorAuthDuoPopout || inPopout) {
|
||||||
return DuoLaunchAction.DIRECT_LAUNCH;
|
return DuoLaunchAction.DIRECT_LAUNCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user