From a858b266e6003135c866f44db72acad62d9ee6e0 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Tue, 14 Oct 2025 14:02:52 +0000 Subject: [PATCH] Fix TOTPSetup component errors --- src/components/auth/TOTPSetup.tsx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/components/auth/TOTPSetup.tsx b/src/components/auth/TOTPSetup.tsx index b3d49409..070345f9 100644 --- a/src/components/auth/TOTPSetup.tsx +++ b/src/components/auth/TOTPSetup.tsx @@ -42,9 +42,10 @@ export function TOTPSetup() { const totpFactors = (data.totp || []).map(factor => ({ id: factor.id, friendly_name: factor.friendly_name || 'Authenticator App', - factor_type: factor.factor_type || 'totp', - status: factor.status, - created_at: factor.created_at + factor_type: 'totp' as const, + status: factor.status as 'verified' | 'unverified', + created_at: factor.created_at, + updated_at: factor.updated_at })); setFactors(totpFactors); } catch (error: any) { @@ -109,7 +110,9 @@ export function TOTPSetup() { // Check if user signed in via OAuth and trigger step-up flow const authMethod = getAuthMethod(); - if (authMethod === 'oauth') { + const isOAuthUser = authMethod === 'oauth'; + + if (isOAuthUser) { console.log('[TOTPSetup] OAuth user enrolled MFA, triggering step-up...'); setStepUpRequired(true, window.location.pathname); navigate('/auth/mfa-step-up'); @@ -124,11 +127,8 @@ export function TOTPSetup() { }); if (isOAuthUser) { - // For OAuth users, trigger step-up flow immediately - setTimeout(() => { - sessionStorage.setItem('mfa_step_up_required', 'true'); - window.location.href = '/auth/mfa-step-up'; - }, 1500); + // Already handled above with navigate + return; } else { // For email/password users, force sign out to require MFA on next login setTimeout(async () => {