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:
parent
15a7f86344
commit
81463614c9
8 changed files with 54 additions and 12 deletions
|
|
@ -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())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue