mirror of
https://github.com/bitwarden/browser.git
synced 2025-02-23 02:31:26 +01:00
added 2fa enabled (#3711)
This commit is contained in:
parent
8676d194d0
commit
c0e872e576
@ -37,9 +37,11 @@ export class LoginWithDeviceComponent
|
|||||||
onSuccessfulLoginTwoFactorNavigate: () => Promise<any>;
|
onSuccessfulLoginTwoFactorNavigate: () => Promise<any>;
|
||||||
onSuccessfulLogin: () => Promise<any>;
|
onSuccessfulLogin: () => Promise<any>;
|
||||||
onSuccessfulLoginNavigate: () => Promise<any>;
|
onSuccessfulLoginNavigate: () => Promise<any>;
|
||||||
|
onSuccessfulLoginForceResetNavigate: () => Promise<any>;
|
||||||
|
|
||||||
protected twoFactorRoute = "2fa";
|
protected twoFactorRoute = "2fa";
|
||||||
protected successRoute = "vault";
|
protected successRoute = "vault";
|
||||||
|
protected forcePasswordResetRoute = "update-temp-password";
|
||||||
private authRequestKeyPair: [publicKey: ArrayBuffer, privateKey: ArrayBuffer];
|
private authRequestKeyPair: [publicKey: ArrayBuffer, privateKey: ArrayBuffer];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@ -119,14 +121,29 @@ export class LoginWithDeviceComponent
|
|||||||
}
|
}
|
||||||
|
|
||||||
const credentials = await this.buildLoginCredntials(requestId, response);
|
const credentials = await this.buildLoginCredntials(requestId, response);
|
||||||
await this.authService.logIn(credentials);
|
const loginResponse = await this.authService.logIn(credentials);
|
||||||
if (this.onSuccessfulLogin != null) {
|
|
||||||
this.onSuccessfulLogin();
|
if (loginResponse.requiresTwoFactor) {
|
||||||
}
|
if (this.onSuccessfulLoginTwoFactorNavigate != null) {
|
||||||
if (this.onSuccessfulLoginNavigate != null) {
|
this.onSuccessfulLoginTwoFactorNavigate();
|
||||||
this.onSuccessfulLoginNavigate();
|
} else {
|
||||||
|
this.router.navigate([this.twoFactorRoute]);
|
||||||
|
}
|
||||||
|
} else if (loginResponse.forcePasswordReset) {
|
||||||
|
if (this.onSuccessfulLoginForceResetNavigate != null) {
|
||||||
|
this.onSuccessfulLoginForceResetNavigate();
|
||||||
|
} else {
|
||||||
|
this.router.navigate([this.forcePasswordResetRoute]);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.router.navigate([this.successRoute]);
|
if (this.onSuccessfulLogin != null) {
|
||||||
|
this.onSuccessfulLogin();
|
||||||
|
}
|
||||||
|
if (this.onSuccessfulLoginNavigate != null) {
|
||||||
|
this.onSuccessfulLoginNavigate();
|
||||||
|
} else {
|
||||||
|
this.router.navigate([this.successRoute]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.logService.error(error);
|
this.logService.error(error);
|
||||||
|
Loading…
Reference in New Issue
Block a user