mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 11:11:14 -05:00
Fix TOTPSetup component errors
This commit is contained in:
@@ -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 () => {
|
||||
|
||||
Reference in New Issue
Block a user