forbid empty password on user creation

This commit is contained in:
jkoberg
2021-10-25 14:54:44 +02:00
parent 25d6e4efd1
commit 572be6f847
4 changed files with 16 additions and 14 deletions
+5
View File
@@ -179,6 +179,11 @@ func (o Ocs) AddUser(w http.ResponseWriter, r *http.Request) {
return
}
}
if strings.TrimSpace(password) == "" {
mustNotFail(render.Render(w, r, response.ErrRender(data.MetaBadRequest.StatusCode, "empty password not allowed")))
o.logger.Error().Err(err).Str("userid", userid).Msg("empty password not allowed")
return
}
// fallbacks
/* TODO decide if we want to make these fallbacks. Keep in mind: