mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
fix: trigger browser password save prompt on password change
Safari, Chrome, and Firefox only offer to save passwords when they see a real form submission with page navigation, not fetch() + redirect. After the change-password API call succeeds, dynamically create a form with the username and new password (autocomplete=username + new-password), POST it to "/" causing a real navigation. The browser detects the form submission with credential fields and prompts to save. Also make the username field visible (read-only) on the change-password page since Safari ignores hidden inputs for password detection, and add autocomplete attributes to the login page fields.
This commit is contained in:
@@ -57,6 +57,8 @@ export function LoginPage() {
|
||||
<input
|
||||
id="username"
|
||||
type="text"
|
||||
name="username"
|
||||
autoComplete="username"
|
||||
value={username}
|
||||
onChange={(e) => setUsername(e.target.value)}
|
||||
placeholder="Enter username"
|
||||
@@ -71,6 +73,8 @@ export function LoginPage() {
|
||||
<input
|
||||
id="password"
|
||||
type="password"
|
||||
name="password"
|
||||
autoComplete="current-password"
|
||||
value={password}
|
||||
onChange={(e) => setPassword(e.target.value)}
|
||||
placeholder="Enter your password"
|
||||
|
||||
Reference in New Issue
Block a user