Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add must-change-password flag to cli for creating a user #4955

Merged
merged 9 commits into from
Oct 20, 2018
Prev Previous commit
Next Next commit
default to true
  • Loading branch information
adelowo committed Sep 18, 2018
commit d2bc4de7a0a9584dfc42f1fb7f8f4c7d924deb42
11 changes: 10 additions & 1 deletion cmd/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,13 +289,22 @@ func runCreateUser(c *cli.Context) error {
return err
}

var changePassword bool

if c.IsSet("must-change-password") {
changePassword = c.Bool("must-change-password")
} else {
// always default to true
changePassword = true
}

if err := models.CreateUser(&models.User{
Name: c.String("name"),
Email: c.String("email"),
Passwd: c.String("password"),
IsActive: true,
IsAdmin: c.Bool("admin"),
MustChangePassword: c.Bool("must-change-password"),
MustChangePassword: changePassword,
}); err != nil {
return fmt.Errorf("CreateUser: %v", err)
}
Expand Down