mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 08:13:42 +00:00
added 2fa enabled (#3711)
This commit is contained in:
@@ -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,7 +121,21 @@ 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 (loginResponse.requiresTwoFactor) {
|
||||||
|
if (this.onSuccessfulLoginTwoFactorNavigate != null) {
|
||||||
|
this.onSuccessfulLoginTwoFactorNavigate();
|
||||||
|
} else {
|
||||||
|
this.router.navigate([this.twoFactorRoute]);
|
||||||
|
}
|
||||||
|
} else if (loginResponse.forcePasswordReset) {
|
||||||
|
if (this.onSuccessfulLoginForceResetNavigate != null) {
|
||||||
|
this.onSuccessfulLoginForceResetNavigate();
|
||||||
|
} else {
|
||||||
|
this.router.navigate([this.forcePasswordResetRoute]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if (this.onSuccessfulLogin != null) {
|
if (this.onSuccessfulLogin != null) {
|
||||||
this.onSuccessfulLogin();
|
this.onSuccessfulLogin();
|
||||||
}
|
}
|
||||||
@@ -128,6 +144,7 @@ export class LoginWithDeviceComponent
|
|||||||
} else {
|
} else {
|
||||||
this.router.navigate([this.successRoute]);
|
this.router.navigate([this.successRoute]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.logService.error(error);
|
this.logService.error(error);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user