fix: Remove competing auth logic causing post-login redirect loops
- Disable automatic auth check on login page to prevent conflicts - Use window.location.replace instead of href to prevent back button issues - Simplify login flow to eliminate competing redirects - Add console logging for better debugging of login flow 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -364,8 +364,10 @@ const csrfToken = generateCSRFToken();
|
||||
// Use the redirectTo from server or fallback to returnTo
|
||||
const finalRedirect = returnTo || result.redirectTo || '/dashboard';
|
||||
|
||||
// Use window.location.href for full page reload to ensure cookies are set
|
||||
window.location.href = finalRedirect;
|
||||
console.log('[LOGIN] Login successful, redirecting to:', finalRedirect);
|
||||
|
||||
// Use window.location.replace to prevent back button issues
|
||||
window.location.replace(finalRedirect);
|
||||
}
|
||||
} catch (error) {
|
||||
errorMessage.textContent = (error as Error).message;
|
||||
@@ -475,9 +477,13 @@ const csrfToken = generateCSRFToken();
|
||||
}
|
||||
}
|
||||
|
||||
// Skip auth check on login page - let the form handle login flow
|
||||
// Initial auth check with delay to prevent flashing
|
||||
setTimeout(() => {
|
||||
checkAuthState();
|
||||
}, 100);
|
||||
// setTimeout(() => {
|
||||
// checkAuthState();
|
||||
// }, 100);
|
||||
|
||||
// Just hide loading and show form immediately on login page
|
||||
hideLoading();
|
||||
|
||||
</script>
|
||||
Reference in New Issue
Block a user