mirror of
https://github.com/binwiederhier/ntfy.git
synced 2025-07-20 10:04:08 +00:00
fix error message for invalid username/password
This commit is contained in:
parent
e4d22ebd8b
commit
fc7cf5933f
2 changed files with 6 additions and 1 deletions
|
@ -37,7 +37,11 @@ func (s *Server) handleAccountCreate(w http.ResponseWriter, r *http.Request, v *
|
|||
}
|
||||
logvr(v, r).Tag(tagAccount).Field("user_name", newAccount.Username).Info("Creating user %s", newAccount.Username)
|
||||
if err := s.userManager.AddUser(newAccount.Username, newAccount.Password, user.RoleUser); err != nil {
|
||||
return err
|
||||
if err.Error() == "invalid argument" {
|
||||
return errHTTPBadRequestInvalidArgument
|
||||
} else {
|
||||
return err
|
||||
}
|
||||
}
|
||||
v.AccountCreated()
|
||||
return s.writeJSON(w, newSuccessResponse())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue