1
0
mirror of https://github.com/bitwarden/browser.git synced 2025-01-22 21:21:35 +01:00

[PM-2057] update two factor email dialog (#9547)

* migrating two factor email component

* two factor email component migration

* two factor email component migration

* two factor email component migration

* two factor email component migration
This commit is contained in:
vinith-kovan 2024-06-11 23:17:55 +05:30 committed by GitHub
parent e6803e05ee
commit 832abcd955
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 3 deletions

View File

@ -26,12 +26,12 @@
appInputVerbatim="false" appInputVerbatim="false"
/> />
</bit-form-field> </bit-form-field>
<div class="tw-mb-3 tw-flex"> <div class="tw-mb-3 tw-flex tw-items-center">
<button bitButton type="button" buttonType="primary" [bitAction]="sendEmail"> <button bitButton type="button" buttonType="primary" [bitAction]="sendEmail">
{{ "sendEmail" | i18n }} {{ "sendEmail" | i18n }}
</button> </button>
<span class="tw-text-success tw-ml-3" *ngIf="sentEmail"> <span class="tw-text-success tw-ml-3" *ngIf="sentEmail">
{{ "verificationCodeEmailSent" | i18n: sentEmail }} {{ "emailSent" | i18n }}
</span> </span>
</div> </div>
<bit-form-field> <bit-form-field>

View File

@ -31,7 +31,7 @@ export class TwoFactorEmailComponent extends TwoFactorBaseComponent {
emailPromise: Promise<unknown>; emailPromise: Promise<unknown>;
override componentName = "app-two-factor-email"; override componentName = "app-two-factor-email";
formGroup = this.formBuilder.group({ formGroup = this.formBuilder.group({
token: [null], token: ["", [Validators.required]],
email: ["", [Validators.email, Validators.required]], email: ["", [Validators.email, Validators.required]],
}); });
@ -79,6 +79,10 @@ export class TwoFactorEmailComponent extends TwoFactorBaseComponent {
} }
submit = async () => { submit = async () => {
this.formGroup.markAllAsTouched();
if (this.formGroup.invalid) {
return;
}
if (this.enabled) { if (this.enabled) {
await this.disableEmail(); await this.disableEmail();
this.onChangeStatus.emit(false); this.onChangeStatus.emit(false);