From 432a4ddd17dbde02ddbc56bab62cb5a6aa389625 Mon Sep 17 00:00:00 2001 From: vinith-kovan <156108204+vinith-kovan@users.noreply.github.com> Date: Mon, 1 Jul 2024 21:33:51 +0530 Subject: [PATCH] Bug fix - error toast in 2fa (#9623) * Bug fix - error toast in 2fa * Bug fix - Yubikey code obscured * 2FA error fix --- .../src/app/auth/settings/two-factor-email.component.ts | 4 ++-- libs/angular/src/auth/components/two-factor.component.ts | 9 +++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/apps/web/src/app/auth/settings/two-factor-email.component.ts b/apps/web/src/app/auth/settings/two-factor-email.component.ts index 20ee284be04..c37a5ecada6 100644 --- a/apps/web/src/app/auth/settings/two-factor-email.component.ts +++ b/apps/web/src/app/auth/settings/two-factor-email.component.ts @@ -78,15 +78,15 @@ export class TwoFactorEmailComponent extends TwoFactorBaseComponent { } submit = async () => { + this.formGroup.markAllAsTouched(); + if (this.enabled) { await this.disableEmail(); this.onChangeStatus.emit(false); } else { - this.formGroup.markAllAsTouched(); if (this.formGroup.invalid) { return; } - await this.enable(); this.onChangeStatus.emit(true); } diff --git a/libs/angular/src/auth/components/two-factor.component.ts b/libs/angular/src/auth/components/two-factor.component.ts index 4ef18985d8c..d08e9a0a2ef 100644 --- a/libs/angular/src/auth/components/two-factor.component.ts +++ b/libs/angular/src/auth/components/two-factor.component.ts @@ -220,12 +220,9 @@ export class TwoFactorComponent extends CaptchaProtectedComponent implements OnI this.token = this.token.replace(" ", "").trim(); } - try { - await this.doSubmit(); - } catch { - if (this.selectedProviderType === TwoFactorProviderType.WebAuthn && this.webAuthn != null) { - this.webAuthn.start(); - } + await this.doSubmit(); + if (this.selectedProviderType === TwoFactorProviderType.WebAuthn && this.webAuthn != null) { + this.webAuthn.start(); } }