1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-20 02:03:39 +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:
Gbubemi Smith
2022-10-19 10:21:20 -06:00
committed by GitHub
parent ff3420d373
commit cc0199d351
6 changed files with 44 additions and 12 deletions

View File

@@ -38,7 +38,14 @@ const sessionTimeoutLength = 2 * 60 * 1000; // 2 minutes
export class AuthService implements AuthServiceAbstraction {
get email(): string {
return this.logInStrategy instanceof PasswordLogInStrategy ? this.logInStrategy.email : null;
if (
this.logInStrategy instanceof PasswordLogInStrategy ||
this.logInStrategy instanceof PasswordlessLogInStrategy
) {
return this.logInStrategy.email;
}
return null;
}
get masterPasswordHash(): string {
@@ -47,6 +54,18 @@ export class AuthService implements AuthServiceAbstraction {
: null;
}
get accessCode(): string {
return this.logInStrategy instanceof PasswordlessLogInStrategy
? this.logInStrategy.accessCode
: null;
}
get authRequestId(): string {
return this.logInStrategy instanceof PasswordlessLogInStrategy
? this.logInStrategy.authRequestId
: null;
}
private logInStrategy:
| ApiLogInStrategy
| PasswordLogInStrategy
@@ -196,6 +215,10 @@ export class AuthService implements AuthServiceAbstraction {
return this.logInStrategy instanceof PasswordLogInStrategy;
}
authingWithPasswordless(): boolean {
return this.logInStrategy instanceof PasswordlessLogInStrategy;
}
async getAuthStatus(userId?: string): Promise<AuthenticationStatus> {
const isAuthenticated = await this.stateService.getIsAuthenticated({ userId: userId });
if (!isAuthenticated) {