1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2025-11-29 11:50:22 +01:00

prevent changing a provisioned user's password

This commit is contained in:
Hunter Kehoe 2025-08-03 16:07:24 -06:00
parent 15a7f86344
commit 81463614c9
8 changed files with 54 additions and 12 deletions

View file

@ -208,6 +208,9 @@ func (s *Server) handleAccountPasswordChange(w http.ResponseWriter, r *http.Requ
}
logvr(v, r).Tag(tagAccount).Debug("Changing password for user %s", u.Name)
if err := s.userManager.ChangePassword(u.Name, req.NewPassword, false); err != nil {
if errors.Is(err, user.ErrProvisionedUserPasswordChange) {
return errHTTPConflictProvisionedUserPasswordChange
}
return err
}
return s.writeJSON(w, newSuccessResponse())