feat(admin): change passwords from Admin UI (#115) - #137
Merged
Conversation
… passwords Adds an admin-only endpoint to set any user's password (including the admin's own), plus a per-row "Change password" form in the Admin UI. Self-update surfaces a notice that cached subsonicCredentials are stale until re-login. closes #115 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The branch predates the admin-namespace split (#226) and the AdminPage → features/hub-admin/ decomposition, so beyond the textual merge: - PUT /users/:id/password now lives in hubAdminRoutes, reachable at /api/admin/hub/users/:id/password; the api client, the test URLs, and docs/authentication.md updated to the new namespace. - AdminPage.tsx was deleted on main; the ChangePasswordForm and per-row password toggle are ported into features/hub-admin/UsersSection.tsx, with currentUserId taken from the auth store instead of the old find-the-admin heuristic. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011Q3riZ78G26ohMgPDh8F7u
Owner
Author
|
FROM @claude:
|
…orm (refs #115) - Backend: a logged-in non-admin guest PUTting /api/admin/hub/users/:id/password gets 403 from requireOwner and the target's password_enc is unchanged — guards against the route ever losing its preHandler. - Frontend: new UsersSection.test.tsx covers the change-password form — key-icon toggle, mismatch blocks the mutation, updateUserPassword called with the row id, stale-credentials notice only on self-update, API error rendering. Labels gained htmlFor/id pairing so the inputs are accessible-queryable (and correctly associated for real users). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011Q3riZ78G26ohMgPDh8F7u
Owner
Author
|
FROM @claude:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PUT /admin/users/:id/password(admin-only, validates length >= 8, allows admin to change own password).AdminPage, with confirm field and own-account notice that cachedsubsonicCredentialsgo stale until re-login.docs/authentication.mdwith the new endpoint and the stale-credentials caveat.Scope per discussion on #115: admin-only UI for now; non-admin self-service deferred until non-admins can log into the SPA.
closes #115
Test plan
pnpm typecheckpasses.pnpm testpasses (335 hub + 53 frontend)./rest/ping?u=&p=) accepts new and rejects old.🤖 Generated with Claude Code