1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-21 16:18:28 +01:00

PM-2403 - Persist SSO flag between 2FA component and 2FA Options component and back so that the correct onSuccessful login logic can run which closes the tab extension and sidesteps Safari master password invalid issues due to null KDF config / iterations again. Tested on Chrome, Firefox + sidebar, Edge, Opera + sidebar, and Safari (#5535)

This commit is contained in:
Jared Snider 2023-05-29 13:55:37 -04:00 committed by GitHub
parent 9f3365623b
commit 1247463e29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 5 deletions

View File

@ -1,6 +1,6 @@
<header>
<div class="left">
<button type="button" routerLink="/2fa">{{ "close" | i18n }}</button>
<button type="button" (click)="close()">{{ "close" | i18n }}</button>
</div>
<h1 class="center">
<span class="title">{{ "twoStepOptions" | i18n }}</span>

View File

@ -1,5 +1,5 @@
import { Component } from "@angular/core";
import { Router } from "@angular/router";
import { ActivatedRoute, Router } from "@angular/router";
import { TwoFactorOptionsComponent as BaseTwoFactorOptionsComponent } from "@bitwarden/angular/auth/components/two-factor-options.component";
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
@ -15,14 +15,33 @@ export class TwoFactorOptionsComponent extends BaseTwoFactorOptionsComponent {
twoFactorService: TwoFactorService,
router: Router,
i18nService: I18nService,
platformUtilsService: PlatformUtilsService
platformUtilsService: PlatformUtilsService,
private activatedRoute: ActivatedRoute
) {
super(twoFactorService, router, i18nService, platformUtilsService, window);
}
close() {
this.navigateTo2FA();
}
choose(p: any) {
super.choose(p);
this.twoFactorService.setSelectedProvider(p.type);
this.navigateTo2FA();
}
navigateTo2FA() {
const sso = this.activatedRoute.snapshot.queryParamMap.get("sso") === "true";
if (sso) {
// Persist SSO flag back to the 2FA comp if it exists
// in order for successful login logic to work properly for
// SSO + 2FA in browser extension
this.router.navigate(["2fa"], { queryParams: { sso: true } });
} else {
this.router.navigate(["2fa"]);
}
}
}

View File

@ -147,8 +147,16 @@ export class TwoFactorComponent extends BaseTwoFactorComponent {
}
anotherMethod() {
const sso = this.route.snapshot.queryParamMap.get("sso") === "true";
if (sso) {
// We must persist this so when the user returns to the 2FA comp, the
// proper onSuccessfulLogin logic is executed.
this.router.navigate(["2fa-options"], { queryParams: { sso: true } });
} else {
this.router.navigate(["2fa-options"]);
}
}
async isLinux() {
return (await BrowserApi.getPlatformInfo()).os === "linux";