mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 15:11:12 -05:00
Remove debug console logs
This commit is contained in:
@@ -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