Skip to content

Commit

Permalink
PM-8113 - Update ExtensionTwoFactorAuthComponentService to close emai…
Browse files Browse the repository at this point in the history
…l 2FA single action popouts.
  • Loading branch information
JaredSnider-Bitwarden committed Jan 23, 2025
1 parent dd4ef7b commit 171d951
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -26,7 +27,7 @@ export class ExtensionTwoFactorAuthEmailComponentService
type: "warning",
});
if (confirmed) {
await BrowserPopupUtils.openCurrentPagePopout(this.window);
await openTwoFactorAuthEmailPopout();
}
}
}
Expand Down

0 comments on commit 171d951

Please sign in to comment.