Add user password edition as admin on all users
This commit is contained in:
parent
4703a18b78
commit
fda1bc076a
@ -69,6 +69,7 @@ func UpdateUserHandler(env *web.Env, w http.ResponseWriter, r *http.Request) err
|
||||
Activated bool `json:"activated"`
|
||||
PolochonURL string `json:"polochonUrl"`
|
||||
PolochonToken string `json:"polochonToken"`
|
||||
Password string `json:"password"`
|
||||
}
|
||||
if err := json.NewDecoder(r.Body).Decode(&data); err != nil {
|
||||
return err
|
||||
@ -95,6 +96,15 @@ func UpdateUserHandler(env *web.Env, w http.ResponseWriter, r *http.Request) err
|
||||
user.Admin = data.Admin
|
||||
user.Activated = data.Activated
|
||||
|
||||
if data.Password != "" {
|
||||
// Update the user config
|
||||
var err error
|
||||
user.Hash, err = env.Auth.GenHash(data.Password)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
log.Debugf("updating user")
|
||||
|
||||
// Save the user with the new configurations
|
||||
|
Loading…
x
Reference in New Issue
Block a user