style(cli): minor fix

This commit is contained in:
bergquist
2016-08-24 20:27:41 +02:00
parent c087445d51
commit 5d821d3492

View File

@@ -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,
} }