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