mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-24 11:31:12 -05:00
Remove debug console logs
This commit is contained in:
@@ -89,11 +89,6 @@ export default function Auth() {
|
||||
setSignInCaptchaToken(null);
|
||||
|
||||
try {
|
||||
console.log('[Auth] Attempting sign in...', {
|
||||
email: formData.email,
|
||||
timestamp: new Date().toISOString(),
|
||||
});
|
||||
|
||||
const {
|
||||
data,
|
||||
error
|
||||
@@ -109,7 +104,6 @@ export default function Auth() {
|
||||
|
||||
// Check if MFA is required (user exists but no session)
|
||||
if (data.user && !data.session) {
|
||||
console.log('[Auth] MFA required');
|
||||
const totpFactor = data.user.factors?.find(f => f.factor_type === 'totp' && f.status === 'verified');
|
||||
|
||||
if (totpFactor) {
|
||||
@@ -127,8 +121,6 @@ export default function Auth() {
|
||||
const postAuthResult = await handlePostAuthFlow(data.session, 'password');
|
||||
|
||||
if (postAuthResult.success && postAuthResult.data.shouldRedirect) {
|
||||
console.log('[Auth] MFA step-up required');
|
||||
|
||||
// Get the TOTP factor ID
|
||||
const { data: factors } = await supabase.auth.mfa.listFactors();
|
||||
const totpFactor = factors?.totp?.find(f => f.status === 'verified');
|
||||
@@ -140,24 +132,16 @@ export default function Auth() {
|
||||
}
|
||||
}
|
||||
|
||||
console.log('[Auth] Sign in successful', {
|
||||
user: data.user?.email,
|
||||
session: !!data.session,
|
||||
sessionExpiry: data.session?.expires_at
|
||||
});
|
||||
|
||||
// Verify session was stored
|
||||
setTimeout(async () => {
|
||||
const { data: { session } } = await supabase.auth.getSession();
|
||||
if (!session) {
|
||||
console.error('[Auth] Session not found after login!');
|
||||
toast({
|
||||
variant: "destructive",
|
||||
title: "Session Error",
|
||||
description: "Login succeeded but session was not stored. Please check your browser settings and enable cookies/storage."
|
||||
});
|
||||
} else {
|
||||
console.log('[Auth] Session verified after login');
|
||||
toast({
|
||||
title: "Welcome back!",
|
||||
description: "You've been signed in successfully."
|
||||
@@ -447,18 +431,9 @@ export default function Auth() {
|
||||
<Label>Security Verification</Label>
|
||||
<TurnstileCaptcha
|
||||
key={signInCaptchaKey}
|
||||
onSuccess={(token) => {
|
||||
console.log('Sign-in CAPTCHA success:', token);
|
||||
setSignInCaptchaToken(token);
|
||||
}}
|
||||
onError={(error) => {
|
||||
console.log('Sign-in CAPTCHA error:', error);
|
||||
setSignInCaptchaToken(null);
|
||||
}}
|
||||
onExpire={() => {
|
||||
console.log('Sign-in CAPTCHA expired');
|
||||
setSignInCaptchaToken(null);
|
||||
}}
|
||||
onSuccess={setSignInCaptchaToken}
|
||||
onError={() => setSignInCaptchaToken(null)}
|
||||
onExpire={() => setSignInCaptchaToken(null)}
|
||||
siteKey={import.meta.env.VITE_TURNSTILE_SITE_KEY}
|
||||
theme="auto"
|
||||
/>
|
||||
|
||||
@@ -30,7 +30,6 @@ export default function AuthCallback() {
|
||||
// Check if this is a password recovery flow first
|
||||
const hash = window.location.hash;
|
||||
if (hash.includes('type=recovery')) {
|
||||
console.log('[AuthCallback] Password recovery detected');
|
||||
setIsRecoveryMode(true);
|
||||
setStatus('success'); // Stop the loading spinner
|
||||
return; // Don't process further
|
||||
@@ -40,19 +39,15 @@ export default function AuthCallback() {
|
||||
const { data: { session }, error: sessionError } = await supabase.auth.getSession();
|
||||
|
||||
if (sessionError) {
|
||||
console.error('[AuthCallback] Session error:', sessionError);
|
||||
throw sessionError;
|
||||
}
|
||||
|
||||
if (!session) {
|
||||
console.log('[AuthCallback] No session found, redirecting to auth');
|
||||
navigate('/auth');
|
||||
return;
|
||||
}
|
||||
|
||||
const user = session.user;
|
||||
console.log('[AuthCallback] User authenticated:', user.id);
|
||||
|
||||
|
||||
// Check if this is a new OAuth user (created within last minute)
|
||||
const createdAt = new Date(user.created_at);
|
||||
@@ -63,20 +58,11 @@ export default function AuthCallback() {
|
||||
const provider = user.app_metadata?.provider;
|
||||
const isOAuthUser = provider === 'google' || provider === 'discord';
|
||||
|
||||
console.log('[AuthCallback] User info:', {
|
||||
isNewUser,
|
||||
isOAuthUser,
|
||||
provider,
|
||||
createdAt: user.created_at,
|
||||
});
|
||||
|
||||
// If new OAuth user, process profile
|
||||
if (isNewUser && isOAuthUser) {
|
||||
setStatus('processing');
|
||||
|
||||
try {
|
||||
console.log('[AuthCallback] Processing OAuth profile...');
|
||||
|
||||
const { data, error, requestId } = await invokeWithTracking(
|
||||
'process-oauth-profile',
|
||||
{},
|
||||
@@ -84,13 +70,9 @@ export default function AuthCallback() {
|
||||
);
|
||||
|
||||
if (error) {
|
||||
console.error('[AuthCallback] Profile processing error:', error);
|
||||
// Don't throw - allow sign-in to continue even if profile processing fails
|
||||
} else {
|
||||
console.log('[AuthCallback] Profile processed:', data);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('[AuthCallback] Failed to process profile:', error);
|
||||
// Continue anyway - don't block sign-in
|
||||
}
|
||||
}
|
||||
@@ -100,16 +82,11 @@ export default function AuthCallback() {
|
||||
if (isOAuthUser) {
|
||||
authMethod = 'oauth';
|
||||
}
|
||||
|
||||
console.log('[AuthCallback] Auth method:', authMethod);
|
||||
|
||||
// Unified post-authentication flow for ALL methods (OAuth, magic link, etc.)
|
||||
console.log('[AuthCallback] Running post-auth flow...');
|
||||
const result = await handlePostAuthFlow(session, authMethod);
|
||||
|
||||
if (result.success && result.data?.shouldRedirect) {
|
||||
console.log('[AuthCallback] MFA step-up required - showing modal');
|
||||
|
||||
// Get factor ID and show modal instead of redirecting
|
||||
const { data: factors } = await supabase.auth.mfa.listFactors();
|
||||
const totpFactor = factors?.totp?.find(f => f.status === 'verified');
|
||||
@@ -138,7 +115,6 @@ export default function AuthCallback() {
|
||||
|
||||
} catch (error) {
|
||||
const errorMsg = getErrorMessage(error);
|
||||
console.error('[AuthCallback] Error:', errorMsg);
|
||||
setStatus('error');
|
||||
|
||||
toast({
|
||||
@@ -224,7 +200,6 @@ export default function AuthCallback() {
|
||||
|
||||
} catch (error) {
|
||||
const errorMsg = getErrorMessage(error);
|
||||
console.error('[AuthCallback] Password reset error:', errorMsg);
|
||||
toast({
|
||||
variant: 'destructive',
|
||||
title: 'Failed to set password',
|
||||
|
||||
Reference in New Issue
Block a user