From f026a6d6f71beeb467651a49e54e770ef9beca3d Mon Sep 17 00:00:00 2001
From: Harsh Mahajan <127186841+HarshMN2345@users.noreply.github.com>
Date: Fri, 12 Sep 2025 22:49:05 +0530
Subject: [PATCH] refactor: improve MFA challenge form logic and fix account
page issues
---
.../components/mfaChallengeFormList.svelte | 164 ++++++++++--------
src/routes/(console)/account/updateMfa.svelte | 2 +
2 files changed, 98 insertions(+), 68 deletions(-)
diff --git a/src/lib/components/mfaChallengeFormList.svelte b/src/lib/components/mfaChallengeFormList.svelte
index bd5489f0b..6a4ff5200 100644
--- a/src/lib/components/mfaChallengeFormList.svelte
+++ b/src/lib/components/mfaChallengeFormList.svelte
@@ -1,21 +1,31 @@
-{#if challengeType === AuthenticationFactor.Recoverycode}
+{#if enabledMainFactors.length === 0}
+
+{:else if challengeType === AuthenticationFactor.Recoverycode}
- Enter below one of the recovery codes you received when enabling MFA for this account.
+ Enter one of the recovery codes you received when enabling MFA.
-{:else}
- {#if factors.totp && (challengeType === AuthenticationFactor.Totp || challengeType === null)}
- Enter below a 6-digit one-time code generated by your authentication app.
- {:else if challengeType === AuthenticationFactor.Email}
- A 6-digit verification code was sent to your email, enter it below.
- {:else if challengeType === AuthenticationFactor.Phone}
- A 6-digit verification code was sent to your phone, enter it below.
- {/if}
+{:else if challengeType === AuthenticationFactor.Totp}
+
+ Enter a 6-digit one-time code from your authenticator app.
+
+
+{:else if challengeType === AuthenticationFactor.Email}
+
+ A 6-digit verification code was sent to your email. Enter it below.
+
+
+{:else if challengeType === AuthenticationFactor.Phone}
+
+ A 6-digit verification code was sent to your phone. Enter it below.
+
{/if}
-{#if showVerifyButton}
+
+{#if showVerifyButton && enabledMainFactors.length > 0}
{/if}
-{#if enabledFactors.length > 1}
- or
-