mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 04:31:13 -05:00
Refactor: Execute remaining phases
This commit is contained in:
@@ -8,7 +8,7 @@ import { Separator } from '@/components/ui/separator';
|
||||
import { Zap, Mail, Lock, User, Eye, EyeOff } from 'lucide-react';
|
||||
import { supabase } from '@/integrations/supabase/client';
|
||||
import { useToast } from '@/hooks/use-toast';
|
||||
import { getErrorMessage } from '@/lib/errorHandler';
|
||||
import { handleError } from '@/lib/errorHandler';
|
||||
import { TurnstileCaptcha } from './TurnstileCaptcha';
|
||||
import { notificationService } from '@/lib/notificationService';
|
||||
import { useCaptchaBypass } from '@/hooks/useCaptchaBypass';
|
||||
@@ -121,12 +121,15 @@ export function AuthModal({ open, onOpenChange, defaultTab = 'signin' }: AuthMod
|
||||
await new Promise(resolve => setTimeout(resolve, 100));
|
||||
|
||||
onOpenChange(false);
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
setSignInCaptchaKey(prev => prev + 1);
|
||||
toast({
|
||||
variant: "destructive",
|
||||
title: "Sign in failed",
|
||||
description: getErrorMessage(error)
|
||||
handleError(error, {
|
||||
action: 'Sign In',
|
||||
metadata: {
|
||||
method: 'password',
|
||||
hasCaptcha: !!tokenToUse
|
||||
// ⚠️ NEVER log: email, password, tokens
|
||||
}
|
||||
});
|
||||
} finally {
|
||||
setLoading(false);
|
||||
@@ -249,12 +252,15 @@ export function AuthModal({ open, onOpenChange, defaultTab = 'signin' }: AuthMod
|
||||
description: "Please check your email to verify your account."
|
||||
});
|
||||
onOpenChange(false);
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
setCaptchaKey(prev => prev + 1);
|
||||
toast({
|
||||
variant: "destructive",
|
||||
title: "Sign up failed",
|
||||
description: getErrorMessage(error)
|
||||
handleError(error, {
|
||||
action: 'Sign Up',
|
||||
metadata: {
|
||||
hasCaptcha: !!tokenToUse,
|
||||
hasUsername: !!formData.username
|
||||
// ⚠️ NEVER log: email, password, username
|
||||
}
|
||||
});
|
||||
} finally {
|
||||
setLoading(false);
|
||||
@@ -288,11 +294,13 @@ export function AuthModal({ open, onOpenChange, defaultTab = 'signin' }: AuthMod
|
||||
description: "Check your email for a sign-in link."
|
||||
});
|
||||
onOpenChange(false);
|
||||
} catch (error) {
|
||||
toast({
|
||||
variant: "destructive",
|
||||
title: "Failed to send magic link",
|
||||
description: getErrorMessage(error)
|
||||
} catch (error: unknown) {
|
||||
handleError(error, {
|
||||
action: 'Send Magic Link',
|
||||
metadata: {
|
||||
method: 'magic_link'
|
||||
// ⚠️ NEVER log: email, link
|
||||
}
|
||||
});
|
||||
} finally {
|
||||
setMagicLinkLoading(false);
|
||||
@@ -312,11 +320,13 @@ export function AuthModal({ open, onOpenChange, defaultTab = 'signin' }: AuthMod
|
||||
}
|
||||
});
|
||||
if (error) throw error;
|
||||
} catch (error) {
|
||||
toast({
|
||||
variant: "destructive",
|
||||
title: "Social sign in failed",
|
||||
description: getErrorMessage(error)
|
||||
} catch (error: unknown) {
|
||||
handleError(error, {
|
||||
action: 'Social Sign In',
|
||||
metadata: {
|
||||
provider,
|
||||
method: 'oauth'
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user