From 45c0a052ad9fdfa64ac3b7db491bd43cc0918725 Mon Sep 17 00:00:00 2001 From: dzinesco Date: Sat, 12 Jul 2025 21:03:24 -0600 Subject: [PATCH] fix: Remove competing auth logic causing post-login redirect loops MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- src/pages/login.astro | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/pages/login.astro b/src/pages/login.astro index 7a88194..73011ec 100644 --- a/src/pages/login.astro +++ b/src/pages/login.astro @@ -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(); \ No newline at end of file