Add an admin password change flow in the web UI #65
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Part of the road to 1.0 (see #33).
There is no way to change the bootstrap admin password after first login. The profile page (
internal/handlers/profile.go) is view-only. For an internet-facing single-admin service, being unable to rotate the initial password is a real gap.Definition of done:
database.VerifyPasswordbefore accepting a changeinternal/database/password.go)Implementation instructions
routes.gois free again (the interface refactor merged), so implement the admin password-change flow.Scope:
internal/handlers/profile.go(or a new handler file inhandlers),internal/server/routes.go,templates/profile.html, and a handlers test. Reuse the existing password helpers — do not roll new crypto.Behaviour:
setupUserRoutesunder/user/{username}— that group already hasCSRF,RequireAuth, andNoCache— e.g.POST /password.HandleProfileuses for its 403); parsecurrent_password,new_password,confirm_password; verify the current password withdatabase.VerifyPassword; requirenew_passwordto be non-empty and equal toconfirm_password; hash the new password with the SAME mechanism used to create the admin user (seeinternal/database/password.goand howdatabase.gobootstraps the admin) and persist it on the user row; re-render the profile page with a clear success or error message.templates/profile.html(current / new / confirm fields plus the CSRF token, following how the other forms embed CSRF).Definition of done:
Gates and process:
make fmt; validate withdocker build .(must exit 0)mainnamedissue-65-password-change; commit subject ends with(closes #65)main) and comment on it with the diff summary and thedocker build .result; no AI/tooling referencesmainwas just updated (delivery refactor + retention reaper + NoCache). Ifdocker buildfails on something unrelated to your change, check whether an unmodifiedorigin/mainbuilds, and if it does not, STOP and report thatmainis broken rather than trying to fix it.