From d7a76b5bacc92eef90b1fab25e34510e6e541559 Mon Sep 17 00:00:00 2001 From: sirpiglr <49359077-sirpiglr@users.noreply.replit.com> Date: Sun, 21 Dec 2025 04:30:42 +0000 Subject: [PATCH] Fix login issue where users are incorrectly shown as guests Adjust initial state and effect for PassportApp's mode to correctly handle authentication status, preventing an immediate reset to login mode after successful authentication. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 279f1558-c0e3-40e4-8217-be7e9f4c6eca Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 5e981d2c-3a05-4456-83a5-c8477fb3f0a8 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/b984cb14-1d19-4944-922b-bc79e821ed35/279f1558-c0e3-40e4-8217-be7e9f4c6eca/I1D3tV4 Replit-Helium-Checkpoint-Created: true --- client/src/pages/os.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/client/src/pages/os.tsx b/client/src/pages/os.tsx index 07c7deb..48ab8c4 100644 --- a/client/src/pages/os.tsx +++ b/client/src/pages/os.tsx @@ -2794,7 +2794,9 @@ function TerminalApp() { function PassportApp({ onLoginSuccess, isDesktopLocked }: { onLoginSuccess?: () => void; isDesktopLocked?: boolean }) { const { user, isAuthenticated, login, signup, logout } = useAuth(); - const [mode, setMode] = useState<'view' | 'login' | 'signup'>('view'); + const [mode, setMode] = useState<'view' | 'login' | 'signup'>(() => + isDesktopLocked && !isAuthenticated ? 'login' : 'view' + ); const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [username, setUsername] = useState(''); @@ -2817,10 +2819,10 @@ function PassportApp({ onLoginSuccess, isDesktopLocked }: { onLoginSuccess?: () }, [isAuthenticated, isDesktopLocked, onLoginSuccess]); useEffect(() => { - if (!isAuthenticated && isDesktopLocked) { - setMode('login'); + if (isAuthenticated) { + setMode('view'); } - }, [isAuthenticated, isDesktopLocked]); + }, [isAuthenticated]); const handleLogin = async (e: React.FormEvent) => { e.preventDefault();