mirror of
https://github.com/bitwarden/browser.git
synced 2025-02-19 01:51:27 +01:00
PM-8113 - TwoFactorAuthComponent - add setAnonLayoutDataByTwoFactorProviderType and handle email case as POC
This commit is contained in:
parent
94f151779b
commit
ab38b3bd89
@ -860,6 +860,9 @@
|
|||||||
"logInToBitwarden": {
|
"logInToBitwarden": {
|
||||||
"message": "Log in to Bitwarden"
|
"message": "Log in to Bitwarden"
|
||||||
},
|
},
|
||||||
|
"enterTheCodeSentToYourEmail": {
|
||||||
|
"message": "Enter the code sent to your email"
|
||||||
|
},
|
||||||
"restartRegistration": {
|
"restartRegistration": {
|
||||||
"message": "Restart registration"
|
"message": "Restart registration"
|
||||||
},
|
},
|
||||||
|
@ -652,6 +652,9 @@
|
|||||||
"logInToBitwarden": {
|
"logInToBitwarden": {
|
||||||
"message": "Log in to Bitwarden"
|
"message": "Log in to Bitwarden"
|
||||||
},
|
},
|
||||||
|
"enterTheCodeSentToYourEmail": {
|
||||||
|
"message": "Enter the code sent to your email"
|
||||||
|
},
|
||||||
"logInWithPasskey": {
|
"logInWithPasskey": {
|
||||||
"message": "Log in with passkey"
|
"message": "Log in with passkey"
|
||||||
},
|
},
|
||||||
|
@ -1179,6 +1179,9 @@
|
|||||||
"logInToBitwarden": {
|
"logInToBitwarden": {
|
||||||
"message": "Log in to Bitwarden"
|
"message": "Log in to Bitwarden"
|
||||||
},
|
},
|
||||||
|
"enterTheCodeSentToYourEmail": {
|
||||||
|
"message": "Enter the code sent to your email"
|
||||||
|
},
|
||||||
"authenticationTimeout": {
|
"authenticationTimeout": {
|
||||||
"message": "Authentication timeout"
|
"message": "Authentication timeout"
|
||||||
},
|
},
|
||||||
|
@ -37,6 +37,9 @@ import {
|
|||||||
ToastService,
|
ToastService,
|
||||||
} from "@bitwarden/components";
|
} from "@bitwarden/components";
|
||||||
|
|
||||||
|
import { AnonLayoutWrapperDataService } from "../anon-layout/anon-layout-wrapper-data.service";
|
||||||
|
import { TwoFactorAuthEmailIcon } from "../icons/two-factor-auth";
|
||||||
|
|
||||||
import { TwoFactorAuthAuthenticatorComponent } from "./child-components/two-factor-auth-authenticator.component";
|
import { TwoFactorAuthAuthenticatorComponent } from "./child-components/two-factor-auth-authenticator.component";
|
||||||
import { TwoFactorAuthDuoComponent } from "./child-components/two-factor-auth-duo/two-factor-auth-duo.component";
|
import { TwoFactorAuthDuoComponent } from "./child-components/two-factor-auth-duo/two-factor-auth-duo.component";
|
||||||
import { TwoFactorAuthEmailComponent } from "./child-components/two-factor-auth-email/two-factor-auth-email.component";
|
import { TwoFactorAuthEmailComponent } from "./child-components/two-factor-auth-email/two-factor-auth-email.component";
|
||||||
@ -104,8 +107,6 @@ export class TwoFactorAuthComponent implements OnInit, OnDestroy {
|
|||||||
remember: [false],
|
remember: [false],
|
||||||
});
|
});
|
||||||
|
|
||||||
title = "";
|
|
||||||
|
|
||||||
formPromise: Promise<any> | undefined;
|
formPromise: Promise<any> | undefined;
|
||||||
|
|
||||||
submitForm = async () => {
|
submitForm = async () => {
|
||||||
@ -134,6 +135,7 @@ export class TwoFactorAuthComponent implements OnInit, OnDestroy {
|
|||||||
private twoFactorAuthComponentService: TwoFactorAuthComponentService,
|
private twoFactorAuthComponentService: TwoFactorAuthComponentService,
|
||||||
private syncService: SyncService,
|
private syncService: SyncService,
|
||||||
private destroyRef: DestroyRef,
|
private destroyRef: DestroyRef,
|
||||||
|
private anonLayoutWrapperDataService: AnonLayoutWrapperDataService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
@ -146,7 +148,7 @@ export class TwoFactorAuthComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
await this.setSelected2faProviderType();
|
await this.setSelected2faProviderType();
|
||||||
await this.set2faProviderData();
|
await this.set2faProviderData();
|
||||||
await this.setTitleByTwoFactorProviderType();
|
await this.setAnonLayoutDataByTwoFactorProviderType();
|
||||||
|
|
||||||
this.form.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((value) => {
|
this.form.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((value) => {
|
||||||
if (value.token) {
|
if (value.token) {
|
||||||
@ -261,7 +263,7 @@ export class TwoFactorAuthComponent implements OnInit, OnDestroy {
|
|||||||
});
|
});
|
||||||
this.providerData = providerData;
|
this.providerData = providerData;
|
||||||
this.selectedProviderType = response.type;
|
this.selectedProviderType = response.type;
|
||||||
await this.setTitleByTwoFactorProviderType();
|
await this.setAnonLayoutDataByTwoFactorProviderType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -294,13 +296,25 @@ export class TwoFactorAuthComponent implements OnInit, OnDestroy {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
async setTitleByTwoFactorProviderType() {
|
async setAnonLayoutDataByTwoFactorProviderType() {
|
||||||
if (this.selectedProviderType == null) {
|
switch (this.selectedProviderType) {
|
||||||
this.title = this.i18nService.t("loginUnavailable");
|
// case TwoFactorProviderType.Authenticator:
|
||||||
return;
|
// this.anonLayoutWrapperDataService.setAnonLayoutWrapperData({
|
||||||
}
|
// pageTitle: this.i18nService.t("ADD ME"),
|
||||||
|
// pageSubtitle: this.i18nService.t("twoFactorAuthenticatorSubtitle"),
|
||||||
|
// pageIcon: TwoFactorAuthAuthenticatorIcon,
|
||||||
|
// });
|
||||||
|
// break;
|
||||||
|
case TwoFactorProviderType.Email:
|
||||||
|
this.anonLayoutWrapperDataService.setAnonLayoutWrapperData({
|
||||||
|
pageSubtitle: this.i18nService.t("enterTheCodeSentToYourEmail"),
|
||||||
|
pageIcon: TwoFactorAuthEmailIcon,
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
this.title = (TwoFactorProviders as any)[this.selectedProviderType].name;
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async handleAuthResult(authResult: AuthResult) {
|
private async handleAuthResult(authResult: AuthResult) {
|
||||||
|
Loading…
Reference in New Issue
Block a user