Phase 2: Subsonic REST API framework (auth, response formatting, error handling, routing) plus user permission model
This commit is contained in:
@@ -36,12 +36,12 @@ func (h *Web) handleAdminUserCreate(w http.ResponseWriter, r *http.Request) {
|
||||
http.Redirect(w, r, "/admin/users", http.StatusFound)
|
||||
return
|
||||
}
|
||||
hash, err := auth.HashPassword(password)
|
||||
user, err := database.CreateUser(h.DB, username, "", "", isAdmin)
|
||||
if err != nil {
|
||||
http.Error(w, "internal error", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
if _, err := database.CreateUser(h.DB, username, "", hash, isAdmin); err != nil {
|
||||
if err := auth.SetUserPassword(h.DB, h.EncryptionKey, user.ID, password); err != nil {
|
||||
http.Error(w, "internal error", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user