Skip to content

Commit fd37fb0

Browse files
adelowolafriks
authored andcommitted
Don't force a password change for the admin user when creating an account via cli (#5391)
* don't force a password change for the admin user * don't totally dicard -must-change-password flag if creating the first (admin) user via the cli. Use flag if present but make sure to default to not forcing a password update
1 parent 3379141 commit fd37fb0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cmd/admin.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,12 @@ func runCreateUser(c *cli.Context) error {
322322
// always default to true
323323
var changePassword = true
324324

325+
// If this is the first user being created.
326+
// Take it as the admin and don't force a password update.
327+
if n := models.CountUsers(); n == 0 {
328+
changePassword = false
329+
}
330+
325331
if c.IsSet("must-change-password") {
326332
changePassword = c.Bool("must-change-password")
327333
}

0 commit comments

Comments
 (0)