From 315a91e943948f86e3a15027bad1a07da1f5d26c Mon Sep 17 00:00:00 2001 From: Aaron Nelson Date: Sun, 26 Apr 2026 11:56:09 -0400 Subject: [PATCH] =?UTF-8?q?Fix=20login=20button=20=E2=80=94=20useRef=20for?= =?UTF-8?q?=20input,=20window.location=20redirect.=20Add=20logout=20to=20s?= =?UTF-8?q?ettings.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/login/page.tsx | 60 +++++++++++++++--------------------- components/SettingsPanel.tsx | 7 ++++- 2 files changed, 30 insertions(+), 37 deletions(-) diff --git a/app/login/page.tsx b/app/login/page.tsx index f88bfe4..7c77b23 100644 --- a/app/login/page.tsx +++ b/app/login/page.tsx @@ -1,15 +1,14 @@ 'use client'; -import { useState } from 'react'; -import { useRouter } from 'next/navigation'; +import { useState, useRef } from 'react'; export default function LoginPage() { - const [password, setPassword] = useState(''); const [error, setError] = useState(''); const [loading, setLoading] = useState(false); - const router = useRouter(); + const inputRef = useRef(null); async function handleLogin() { + const password = inputRef.current?.value || ''; if (!password || loading) return; setLoading(true); setError(''); @@ -21,39 +20,31 @@ export default function LoginPage() { body: JSON.stringify({ password }), }); if (!res.ok) throw new Error('Invalid password'); - router.push('/'); - router.refresh(); + window.location.href = '/'; } catch { setError('Invalid password'); setLoading(false); } } - function handleKeyDown(e: React.KeyboardEvent) { - if (e.key === 'Enter') handleLogin(); - } - return ( -
-
+
+
Aaron AI @@ -64,13 +55,12 @@ export default function LoginPage() {
setPassword(e.target.value)} - onKeyDown={handleKeyDown} placeholder="Password" autoFocus autoComplete="current-password" + onKeyDown={e => e.key === 'Enter' && handleLogin()} style={{ width: '100%', background: '#faf9f6', @@ -94,7 +84,6 @@ export default function LoginPage() {