Fix login error alert disappearing due to browser autofill

After a failed login, the browser's password manager fires onChange
events on the username/password inputs (clearing or resetting them).
The onChange handlers were calling setLoginError(null), which wiped
the error alert immediately after it appeared.

Fix: remove setLoginError(null) from input onChange handlers. The
error now clears at the start of the next submit attempt via the
existing setLoginError(null) in handleCredentialSubmit.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Kyle 2026-02-28 01:37:57 +08:00
parent b2d81f7015
commit 5426657b2e

View File

@ -496,7 +496,7 @@ export default function LockScreen() {
id="username"
type="text"
value={username}
onChange={(e) => { setUsername(e.target.value); setLoginError(null); }}
onChange={(e) => setUsername(e.target.value)}
placeholder="Enter username"
required
autoFocus
@ -509,7 +509,7 @@ export default function LockScreen() {
id="password"
type="password"
value={password}
onChange={(e) => { setPassword(e.target.value); setLoginError(null); }}
onChange={(e) => setPassword(e.target.value)}
placeholder={isSetup ? 'Create a password' : 'Enter password'}
required
autoComplete={isSetup ? 'new-password' : 'current-password'}