enhancement: Ask for the current password before changing it
Back to our planType
enhancement
Summary
Changing the password should ask for the current password.
Problem
On /account, a signed-in user can set a new password without entering the current one. Anyone with access to an open session (a shared or unlocked computer, a stolen cookie) can take over the account permanently. OWASP recommends re-authentication before changing a password (https://cheatsheetseries.owasp.org/cheatsheets/Authentication_Cheat_Sheet.html#change-password-feature, opens in a new tab). Found during #134; main behaves the same.
Proposed fix
Add a current-password field to the change-password form. The changePassword server action verifies it with Payload (a login check against the session user) before updating, with the same generic error message on failure.
Acceptance criteria
- Not done: A wrong current password is refused with a generic message and the password is unchanged.
- Not done: Unit tests for the action, including a mutation check.
- Not done: Resident sign-up (#187) depends on this.
Area
auth, frontend
Priority
high
Generated by Claude Code, opens in a new tab