mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-09 09:51:02 +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,
|
OnDestroy,
|
||||||
OnInit,
|
OnInit,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
|
|
||||||
import { DeviceType } from '../../enums/deviceType';
|
import { DeviceType } from '../../enums/deviceType';
|
||||||
@ -9,6 +10,8 @@ import { TwoFactorProviderType } from '../../enums/twoFactorProviderType';
|
|||||||
|
|
||||||
import { TwoFactorEmailRequest } from '../../models/request/twoFactorEmailRequest';
|
import { TwoFactorEmailRequest } from '../../models/request/twoFactorEmailRequest';
|
||||||
|
|
||||||
|
import { AuthResult } from '../../models/domain';
|
||||||
|
|
||||||
import { ApiService } from '../../abstractions/api.service';
|
import { ApiService } from '../../abstractions/api.service';
|
||||||
import { AuthService } from '../../abstractions/auth.service';
|
import { AuthService } from '../../abstractions/auth.service';
|
||||||
import { EnvironmentService } from '../../abstractions/environment.service';
|
import { EnvironmentService } from '../../abstractions/environment.service';
|
||||||
@ -37,7 +40,6 @@ export class TwoFactorComponent implements OnInit, OnDestroy {
|
|||||||
twoFactorEmail: string = null;
|
twoFactorEmail: string = null;
|
||||||
formPromise: Promise<any>;
|
formPromise: Promise<any>;
|
||||||
emailPromise: Promise<any>;
|
emailPromise: Promise<any>;
|
||||||
resetMasterPassword: boolean = false;
|
|
||||||
onSuccessfulLogin: () => Promise<any>;
|
onSuccessfulLogin: () => Promise<any>;
|
||||||
onSuccessfulLoginNavigate: () => Promise<any>;
|
onSuccessfulLoginNavigate: () => Promise<any>;
|
||||||
|
|
||||||
@ -60,7 +62,7 @@ export class TwoFactorComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.authService.authingWithSso()) {
|
if (this.authService.authingWithSso()) {
|
||||||
this.successRoute = this.resetMasterPassword ? 'reset-master-password' : 'lock';
|
this.successRoute = 'lock';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.initU2f && this.win != null && this.u2fSupported) {
|
if (this.initU2f && this.win != null && this.u2fSupported) {
|
||||||
@ -176,7 +178,7 @@ export class TwoFactorComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
this.formPromise = this.authService.logInTwoFactor(this.selectedProviderType, this.token, this.remember);
|
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);
|
const disableFavicon = await this.storageService.get<boolean>(ConstantsService.disableFaviconKey);
|
||||||
await this.stateService.save(ConstantsService.disableFaviconKey, !!disableFavicon);
|
await this.stateService.save(ConstantsService.disableFaviconKey, !!disableFavicon);
|
||||||
if (this.onSuccessfulLogin != null) {
|
if (this.onSuccessfulLogin != null) {
|
||||||
@ -186,6 +188,9 @@ export class TwoFactorComponent implements OnInit, OnDestroy {
|
|||||||
if (this.onSuccessfulLoginNavigate != null) {
|
if (this.onSuccessfulLoginNavigate != null) {
|
||||||
this.onSuccessfulLoginNavigate();
|
this.onSuccessfulLoginNavigate();
|
||||||
} else {
|
} else {
|
||||||
|
if (response.resetMasterPassword) {
|
||||||
|
this.successRoute = 'set-password';
|
||||||
|
}
|
||||||
this.router.navigate([this.successRoute]);
|
this.router.navigate([this.successRoute]);
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
|
Loading…
Reference in New Issue
Block a user