feat(webui): add accounts username and isAdmin flag edition for admins
All checks were successful
main / main (push) Successful in 1m44s
main / deploy (push) Has been skipped
main / publish (push) Has been skipped

Closes #43
This commit is contained in:
Julien Dessaux 2025-05-03 09:48:53 +02:00
parent 4f68621bad
commit 373f567773
Signed by: adyxax
GPG key ID: F92E51B86E07177E
6 changed files with 111 additions and 50 deletions

View file

@ -81,11 +81,17 @@ func handleAccountsIdResetPasswordPOST(db *database.DB) http.Handler {
return
}
account.SetPassword(password)
if err := db.SaveAccount(account); err != nil {
success, err := db.SaveAccount(account)
if err != nil {
errorResponse(w, r, http.StatusInternalServerError,
fmt.Errorf("failed to save account: %w", err))
return
}
if !success {
errorResponse(w, r, http.StatusInternalServerError,
fmt.Errorf("failed to save account: table constraint error"))
return
}
render(w, accountsIdResetPasswordTemplates, http.StatusOK,
AccountsIdResetPasswordPage{
Account: account,