Add remember me checkbox, center and narrow sign-in form

- Add "Remember me for 30 days" checkbox (30-day vs 24-hour session expiry)
- Center heading and constrain form width to max-w-md
- Preserve remember_me preference through TOTP and WebAuthn auth flows

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Dan Milne
2026-04-11 11:22:51 +10:00
parent 2235924f37
commit 9197524c88
4 changed files with 29 additions and 9 deletions

View File

@@ -180,7 +180,8 @@ export default class extends Controller {
"X-CSRF-Token": this.getCSRFToken()
},
body: JSON.stringify({
email: this.getUserEmail()
email: this.getUserEmail(),
remember_me: this.getRememberMe()
})
});
@@ -295,6 +296,11 @@ export default class extends Controller {
return emailInput ? emailInput.value.trim() : "";
}
getRememberMe() {
const checkbox = document.querySelector('input[name="remember_me"][type="checkbox"]');
return checkbox ? checkbox.checked : false;
}
isValidEmail(email) {
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
}