Once authentication is in place (depends on #15), users can only get a password through npm run user:create. Let a logged-in user change their own password from the UI.
Requirements
Server
New endpoint POST /api/v1/auth/password, available only to an authenticated user and only when auth is enabled.
Checks oldPassword against the current user's stored hash and, if it matches, replaces the hash with a new scrypt hash of newPassword (same hashing as in user:create).
Responses:
204 on success
400 if the body is invalid or the old password doesn't match. Not 401: the client treats 401 as "not logged in" and redirects to the login page.
The current token stays valid after the change.
Documented in Swagger.
Client
New "Change password" page with two fields: old password, new password, repeat new password. No email confirmation, no 2FA.
Password fields have visibility toggle buttons.
Reachable from the same place as the logout action, and shown only when auth is enabled.
On success, show a confirmation message. On a wrong old password, show an error and keep the user on the page.
New strings in en.json; Storybook stories for any new client/src/ui/ components.
Docs
Mention the endpoint and the page in the relevant docs (docs/architecture.md).
Acceptance criteria
With the correct old password, the password changes: logging in works with the new password and fails with the old one.
With a wrong old password, the endpoint returns 400 and the stored hash is unchanged.
Unauthenticated requests return 401.
Server tests cover success, wrong old password, invalid body and unauthenticated access.
## Summary
Once authentication is in place (depends on #15), users can only get a password through `npm run user:create`. Let a logged-in user change their own password from the UI.
## Requirements
### Server
- New endpoint `POST /api/v1/auth/password`, available only to an authenticated user and only when auth is enabled.
- Request body: `{ "oldPassword": "...", "newPassword": "..." }` (validated DTO, both non-empty strings).
- Checks `oldPassword` against the current user's stored hash and, if it matches, replaces the hash with a new scrypt hash of `newPassword` (same hashing as in `user:create`).
- Responses:
- `204` on success
- `400` if the body is invalid or the old password doesn't match. Not `401`: the client treats `401` as "not logged in" and redirects to the login page.
- The current token stays valid after the change.
- Documented in Swagger.
### Client
- New "Change password" page with two fields: old password, new password, repeat new password. No email confirmation, no 2FA.
- Password fields have visibility toggle buttons.
- Reachable from the same place as the logout action, and shown only when auth is enabled.
- On success, show a confirmation message. On a wrong old password, show an error and keep the user on the page.
- New strings in `en.json`; Storybook stories for any new `client/src/ui/` components.
### Docs
- Mention the endpoint and the page in the relevant docs (`docs/architecture.md`).
## Acceptance criteria
- With the correct old password, the password changes: logging in works with the new password and fails with the old one.
- With a wrong old password, the endpoint returns `400` and the stored hash is unchanged.
- Unauthenticated requests return `401`.
- Server tests cover success, wrong old password, invalid body and unauthenticated access.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
Once authentication is in place (depends on #15), users can only get a password through
npm run user:create. Let a logged-in user change their own password from the UI.Requirements
Server
POST /api/v1/auth/password, available only to an authenticated user and only when auth is enabled.{ "oldPassword": "...", "newPassword": "..." }(validated DTO, both non-empty strings).oldPasswordagainst the current user's stored hash and, if it matches, replaces the hash with a new scrypt hash ofnewPassword(same hashing as inuser:create).204on success400if the body is invalid or the old password doesn't match. Not401: the client treats401as "not logged in" and redirects to the login page.Client
en.json; Storybook stories for any newclient/src/ui/components.Docs
docs/architecture.md).Acceptance criteria
400and the stored hash is unchanged.401.