Update src/routes/(console)/account/updateMfa.svelte

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
Harsh Mahajanandcoderabbitai[bot] authored and GitHub committed 2025-09-15 00:00:50 +05:30
1 parent 106d48c897
commit 62f8d3f1c4
1 file changed
+5 -1
@@ -80,11 +80,15 @@
await sdk.forConsole.account.updateMFA({ mfa: !$user.mfa });
if (!$user.mfa && $user.emailVerification && !$factors.email) {
// Automatically set up email MFA when enabling MFA if the user has a verified email
// This provides a fallback authentication method without requiring user interaction
try {
await sdk.forConsole.account.createMFAChallenge({
factor: AuthenticationFactor.Email
});
} catch (emailError) {}
} catch (emailError) {
// Silently ignore - email MFA is optional and shouldn't block MFA enablement
}
}
await Promise.all([invalidate(Dependencies.ACCOUNT), invalidate(Dependencies.FACTORS)]);