mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Cli: Fix bug where password is hashed twice (#88589)
This commit is contained in:
parent
221e036233
commit
68f2585712
@ -47,7 +47,7 @@ func resetPasswordCommand(c utils.CommandLine, runner server.Runner) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func resetPassword(adminId int64, newPassword user.Password, userSvc user.Service) error {
|
func resetPassword(adminId int64, password user.Password, userSvc user.Service) error {
|
||||||
userQuery := user.GetUserByIDQuery{ID: adminId}
|
userQuery := user.GetUserByIDQuery{ID: adminId}
|
||||||
usr, err := userSvc.GetByID(context.Background(), &userQuery)
|
usr, err := userSvc.GetByID(context.Background(), &userQuery)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -57,11 +57,6 @@ func resetPassword(adminId int64, newPassword user.Password, userSvc user.Servic
|
|||||||
return ErrMustBeAdmin
|
return ErrMustBeAdmin
|
||||||
}
|
}
|
||||||
|
|
||||||
password, err := newPassword.Hash(usr.Salt)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := userSvc.Update(context.Background(), &user.UpdateUserCommand{UserID: adminId, Password: &password}); err != nil {
|
if err := userSvc.Update(context.Background(), &user.UpdateUserCommand{UserID: adminId, Password: &password}); err != nil {
|
||||||
return fmt.Errorf("failed to update user password: %w", err)
|
return fmt.Errorf("failed to update user password: %w", err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user