mirror of
https://github.com/bitwarden/browser.git
synced 2025-02-11 00:31:45 +01:00
[SSO] Bug - Fixed set password route (#156)
* Fixed 2fa + set password bug// moved query params parsing in shared lib * Removed unnecessary params parse // added auth result conditional for success route
This commit is contained in:
parent
e55528e617
commit
8f27110754
@ -2,6 +2,7 @@ import {
|
||||
OnDestroy,
|
||||
OnInit,
|
||||
} from '@angular/core';
|
||||
|
||||
import { Router } from '@angular/router';
|
||||
|
||||
import { DeviceType } from '../../enums/deviceType';
|
||||
@ -9,6 +10,8 @@ import { TwoFactorProviderType } from '../../enums/twoFactorProviderType';
|
||||
|
||||
import { TwoFactorEmailRequest } from '../../models/request/twoFactorEmailRequest';
|
||||
|
||||
import { AuthResult } from '../../models/domain';
|
||||
|
||||
import { ApiService } from '../../abstractions/api.service';
|
||||
import { AuthService } from '../../abstractions/auth.service';
|
||||
import { EnvironmentService } from '../../abstractions/environment.service';
|
||||
@ -37,7 +40,6 @@ export class TwoFactorComponent implements OnInit, OnDestroy {
|
||||
twoFactorEmail: string = null;
|
||||
formPromise: Promise<any>;
|
||||
emailPromise: Promise<any>;
|
||||
resetMasterPassword: boolean = false;
|
||||
onSuccessfulLogin: () => Promise<any>;
|
||||
onSuccessfulLoginNavigate: () => Promise<any>;
|
||||
|
||||
@ -60,7 +62,7 @@ export class TwoFactorComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
if (this.authService.authingWithSso()) {
|
||||
this.successRoute = this.resetMasterPassword ? 'reset-master-password' : 'lock';
|
||||
this.successRoute = 'lock';
|
||||
}
|
||||
|
||||
if (this.initU2f && this.win != null && this.u2fSupported) {
|
||||
@ -176,7 +178,7 @@ export class TwoFactorComponent implements OnInit, OnDestroy {
|
||||
|
||||
try {
|
||||
this.formPromise = this.authService.logInTwoFactor(this.selectedProviderType, this.token, this.remember);
|
||||
await this.formPromise;
|
||||
const response: AuthResult = await this.formPromise;
|
||||
const disableFavicon = await this.storageService.get<boolean>(ConstantsService.disableFaviconKey);
|
||||
await this.stateService.save(ConstantsService.disableFaviconKey, !!disableFavicon);
|
||||
if (this.onSuccessfulLogin != null) {
|
||||
@ -186,6 +188,9 @@ export class TwoFactorComponent implements OnInit, OnDestroy {
|
||||
if (this.onSuccessfulLoginNavigate != null) {
|
||||
this.onSuccessfulLoginNavigate();
|
||||
} else {
|
||||
if (response.resetMasterPassword) {
|
||||
this.successRoute = 'set-password';
|
||||
}
|
||||
this.router.navigate([this.successRoute]);
|
||||
}
|
||||
} catch {
|
||||
|
Loading…
Reference in New Issue
Block a user