mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
style(cli): minor fix
This commit is contained in:
@@ -10,6 +10,8 @@ import (
|
|||||||
"github.com/grafana/grafana/pkg/util"
|
"github.com/grafana/grafana/pkg/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const AdminUserId = 1
|
||||||
|
|
||||||
func resetPasswordCommand(c CommandLine) error {
|
func resetPasswordCommand(c CommandLine) error {
|
||||||
newPassword := c.Args().First()
|
newPassword := c.Args().First()
|
||||||
|
|
||||||
@@ -17,7 +19,7 @@ func resetPasswordCommand(c CommandLine) error {
|
|||||||
return fmt.Errorf("New password too short")
|
return fmt.Errorf("New password too short")
|
||||||
}
|
}
|
||||||
|
|
||||||
userQuery := models.GetUserByIdQuery{Id: 1}
|
userQuery := models.GetUserByIdQuery{Id: AdminUserId}
|
||||||
|
|
||||||
if err := bus.Dispatch(&userQuery); err != nil {
|
if err := bus.Dispatch(&userQuery); err != nil {
|
||||||
return fmt.Errorf("Could not read user from database. Error: %v", err)
|
return fmt.Errorf("Could not read user from database. Error: %v", err)
|
||||||
@@ -26,7 +28,7 @@ func resetPasswordCommand(c CommandLine) error {
|
|||||||
passwordHashed := util.EncodePassword(newPassword, userQuery.Result.Salt)
|
passwordHashed := util.EncodePassword(newPassword, userQuery.Result.Salt)
|
||||||
|
|
||||||
cmd := models.ChangeUserPasswordCommand{
|
cmd := models.ChangeUserPasswordCommand{
|
||||||
UserId: 1,
|
UserId: AdminUserId,
|
||||||
NewPassword: passwordHashed,
|
NewPassword: passwordHashed,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user