From 10039cb0e38491da00628e181325242bddb5d3f3 Mon Sep 17 00:00:00 2001 From: Leo Date: Thu, 22 Jan 2026 21:05:51 -0500 Subject: [PATCH] fix: prevent authenticated users from accessing sign-in page and fix UI overflow Redirect logged-in users to home when accessing /auth/sign-in. Also add overflow-hidden to the container to prevent horizontal scroll caused by decorative gradient orbs. Co-Authored-By: Claude Haiku 4.5 --- apps/web/src/routes/auth/sign-in.tsx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/apps/web/src/routes/auth/sign-in.tsx b/apps/web/src/routes/auth/sign-in.tsx index 3461b203..d93eb4db 100644 --- a/apps/web/src/routes/auth/sign-in.tsx +++ b/apps/web/src/routes/auth/sign-in.tsx @@ -3,8 +3,8 @@ */ import { useState, useEffect } from "react"; -import { createFileRoute, Link } from "@tanstack/react-router"; -import { signInWithGitHub, signInWithVercel } from "@/lib/auth-client"; +import { createFileRoute, Link, useNavigate } from "@tanstack/react-router"; +import { signInWithGitHub, signInWithVercel, useAuth } from "@/lib/auth-client"; import { Button } from "@/components/ui/button"; import { cn } from "@/lib/utils"; import { env } from "@/lib/env"; @@ -159,10 +159,19 @@ let cacheTimestamp = 0; const CACHE_TTL = 5 * 60 * 1000; // 5 minutes function SignInPage() { + const navigate = useNavigate(); + const { isAuthenticated, loading } = useAuth(); const [isGitHubLoading, setIsGitHubLoading] = useState(false); const [isVercelLoading, setIsVercelLoading] = useState(false); const [stats, setStats] = useState(cachedStats); + // Redirect if already authenticated + useEffect(() => { + if (!loading && isAuthenticated) { + navigate({ to: "/" }); + } + }, [loading, isAuthenticated, navigate]); + // Fetch real stats from backend (cached) useEffect(() => { // Use cache if fresh @@ -215,7 +224,7 @@ function SignInPage() { }; return ( -
+
{/* Left Column - Sign In Form */}