mirror of
https://github.com/bitwarden/browser
synced 2025-12-19 09:43:23 +00:00
[SG-698] Passwordless Login with 2FA enabled does not redirect to 2FA page (#3820)
* added 2fa enabled * added passwordless authentication to 2fa * passwordless strategy to authservice * changes to 2FA to allow email sending for passwordless * updated imports
This commit is contained in:
@@ -10,7 +10,6 @@ import { TokenService } from "../../abstractions/token.service";
|
||||
import { TwoFactorService } from "../../abstractions/twoFactor.service";
|
||||
import { AuthResult } from "../../models/domain/auth-result";
|
||||
import { PasswordlessLogInCredentials } from "../../models/domain/log-in-credentials";
|
||||
import { SymmetricCryptoKey } from "../../models/domain/symmetric-crypto-key";
|
||||
import { PasswordTokenRequest } from "../../models/request/identity-token/password-token.request";
|
||||
import { TokenTwoFactorRequest } from "../../models/request/identity-token/token-two-factor.request";
|
||||
|
||||
@@ -21,14 +20,16 @@ export class PasswordlessLogInStrategy extends LogInStrategy {
|
||||
return this.tokenRequest.email;
|
||||
}
|
||||
|
||||
get masterPasswordHash() {
|
||||
return this.tokenRequest.masterPasswordHash;
|
||||
get accessCode() {
|
||||
return this.passwordlessCredentials.accessCode;
|
||||
}
|
||||
|
||||
get authRequestId() {
|
||||
return this.passwordlessCredentials.authRequestId;
|
||||
}
|
||||
|
||||
tokenRequest: PasswordTokenRequest;
|
||||
|
||||
private localHashedPassword: string;
|
||||
private key: SymmetricCryptoKey;
|
||||
private passwordlessCredentials: PasswordlessLogInCredentials;
|
||||
|
||||
constructor(
|
||||
cryptoService: CryptoService,
|
||||
@@ -56,8 +57,8 @@ export class PasswordlessLogInStrategy extends LogInStrategy {
|
||||
}
|
||||
|
||||
async onSuccessfulLogin() {
|
||||
await this.cryptoService.setKey(this.key);
|
||||
await this.cryptoService.setKeyHash(this.localHashedPassword);
|
||||
await this.cryptoService.setKey(this.passwordlessCredentials.decKey);
|
||||
await this.cryptoService.setKeyHash(this.passwordlessCredentials.localPasswordHash);
|
||||
}
|
||||
|
||||
async logInTwoFactor(
|
||||
@@ -69,8 +70,7 @@ export class PasswordlessLogInStrategy extends LogInStrategy {
|
||||
}
|
||||
|
||||
async logIn(credentials: PasswordlessLogInCredentials) {
|
||||
this.localHashedPassword = credentials.localPasswordHash;
|
||||
this.key = credentials.decKey;
|
||||
this.passwordlessCredentials = credentials;
|
||||
|
||||
this.tokenRequest = new PasswordTokenRequest(
|
||||
credentials.email,
|
||||
|
||||
Reference in New Issue
Block a user