mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 17:51:12 -05:00
Fix TOTPSetup component errors
This commit is contained in:
@@ -42,9 +42,10 @@ export function TOTPSetup() {
|
|||||||
const totpFactors = (data.totp || []).map(factor => ({
|
const totpFactors = (data.totp || []).map(factor => ({
|
||||||
id: factor.id,
|
id: factor.id,
|
||||||
friendly_name: factor.friendly_name || 'Authenticator App',
|
friendly_name: factor.friendly_name || 'Authenticator App',
|
||||||
factor_type: factor.factor_type || 'totp',
|
factor_type: 'totp' as const,
|
||||||
status: factor.status,
|
status: factor.status as 'verified' | 'unverified',
|
||||||
created_at: factor.created_at
|
created_at: factor.created_at,
|
||||||
|
updated_at: factor.updated_at
|
||||||
}));
|
}));
|
||||||
setFactors(totpFactors);
|
setFactors(totpFactors);
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
@@ -109,7 +110,9 @@ export function TOTPSetup() {
|
|||||||
|
|
||||||
// Check if user signed in via OAuth and trigger step-up flow
|
// Check if user signed in via OAuth and trigger step-up flow
|
||||||
const authMethod = getAuthMethod();
|
const authMethod = getAuthMethod();
|
||||||
if (authMethod === 'oauth') {
|
const isOAuthUser = authMethod === 'oauth';
|
||||||
|
|
||||||
|
if (isOAuthUser) {
|
||||||
console.log('[TOTPSetup] OAuth user enrolled MFA, triggering step-up...');
|
console.log('[TOTPSetup] OAuth user enrolled MFA, triggering step-up...');
|
||||||
setStepUpRequired(true, window.location.pathname);
|
setStepUpRequired(true, window.location.pathname);
|
||||||
navigate('/auth/mfa-step-up');
|
navigate('/auth/mfa-step-up');
|
||||||
@@ -124,11 +127,8 @@ export function TOTPSetup() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (isOAuthUser) {
|
if (isOAuthUser) {
|
||||||
// For OAuth users, trigger step-up flow immediately
|
// Already handled above with navigate
|
||||||
setTimeout(() => {
|
return;
|
||||||
sessionStorage.setItem('mfa_step_up_required', 'true');
|
|
||||||
window.location.href = '/auth/mfa-step-up';
|
|
||||||
}, 1500);
|
|
||||||
} else {
|
} else {
|
||||||
// For email/password users, force sign out to require MFA on next login
|
// For email/password users, force sign out to require MFA on next login
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user