Skip to content

Commit

Permalink
revert to old behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
wxiaoguang committed Apr 27, 2024
1 parent 849a130 commit d06d526
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions cmd/admin_user_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ var microcmdUserCreate = &cli.Command{
},
&cli.BoolFlag{
Name: "must-change-password",
Usage: "User must change password after initial login, defaults to true for all users except the first admin user (can be disabled by --must-change-password=false)",
Usage: "User must change password after initial login, defaults to true for all users except the first one (can be disabled by --must-change-password=false)",
DisableDefaultText: true,
},
&cli.IntFlag{
Expand Down Expand Up @@ -129,7 +129,7 @@ func runCreateUser(c *cli.Context) error {
if err != nil {
return fmt.Errorf("IsTableNotEmpty: %w", err)
}
if !hasUserRecord && isAdmin {
if !hasUserRecord {
// if this is the first admin being created, don't force to change password (keep the old behavior)
mustChangePassword = false
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/admin_user_create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func TestAdminUserCreate(t *testing.T) {
return createCheck{u.IsAdmin, u.MustChangePassword}
}
reset()
assert.Equal(t, createCheck{IsAdmin: false, MustChangePassword: true}, createUser("u", ""), "first non-admin user must change password")
assert.Equal(t, createCheck{IsAdmin: false, MustChangePassword: true}, createUser("u", ""), "first non-admin user doesn't need to change password")

reset()
assert.Equal(t, createCheck{IsAdmin: true, MustChangePassword: false}, createUser("u", "--admin"), "first admin user doesn't need to change password")
Expand Down

0 comments on commit d06d526

Please sign in to comment.