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 d2a89bc1d2..c4152db7cd 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 @@ -55,6 +55,10 @@ export class ExtensionTwoFactorAuthComponentService } } + closeWindow(): void { + this.window.close(); + } + async handleSso2faFlowSuccess(): Promise { // Force sidebars (FF && Opera) to reload while exempting current window // because we are just going to close the current window. diff --git a/libs/auth/src/angular/two-factor-auth/two-factor-auth-component.service.ts b/libs/auth/src/angular/two-factor-auth/two-factor-auth-component.service.ts index 9fdc62d48f..3deb009907 100644 --- a/libs/auth/src/angular/two-factor-auth/two-factor-auth-component.service.ts +++ b/libs/auth/src/angular/two-factor-auth/two-factor-auth-component.service.ts @@ -37,6 +37,11 @@ export abstract class TwoFactorAuthComponentService { selected2faProviderType: TwoFactorProviderType, ): Promise; + /** + * Optionally closes the window if the client requires it + */ + abstract closeWindow?(): void; + /** * We used to use the user's master key to encrypt their data. We deprecated that approach * and now use a user key. This method should be called if we detect that the user diff --git a/libs/auth/src/angular/two-factor-auth/two-factor-auth.component.ts b/libs/auth/src/angular/two-factor-auth/two-factor-auth.component.ts index a5bed17e82..e3f575bf33 100644 --- a/libs/auth/src/angular/two-factor-auth/two-factor-auth.component.ts +++ b/libs/auth/src/angular/two-factor-auth/two-factor-auth.component.ts @@ -380,9 +380,10 @@ export class TwoFactorAuthComponent implements OnInit, OnDestroy { ); } - // TODO: extension has this.onSuccessfulLoginTdeNavigate = async () => { - // this.win.close(); - // }; + if (this.twoFactorAuthComponentService.closeWindow) { + this.twoFactorAuthComponentService.closeWindow(); + return; + } await this.router.navigate([this.trustedDeviceEncRoute]); }