Skip to content

fix(auth): require old password and enforce strength on change-password - #203

Open
As9xm wants to merge 1 commit into
MoonTechLab:mainfrom
As9xm:fix/auth-change-password
Open

fix(auth): require old password and enforce strength on change-password#203
As9xm wants to merge 1 commit into
MoonTechLab:mainfrom
As9xm:fix/auth-change-password

Conversation

@As9xm

@As9xm As9xm commented Sep 7, 2026

Copy link
Copy Markdown

Require oldPassword verification and minimum length on password change.
Problem:
POST /api/change-password accepted any newPassword with only a session cookie, no old-password check, no strength rule. Stolen session could take over account.
Fix:

  • src/app/api/change-password/route.ts: require oldPassword, verify via db.verifyUser, enforce newPassword.trim().length >= 6, reject old == new.
  • src/components/UserMenu.tsx: add old-password input, send oldPassword, client-side length check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant