Skip to content

Commit 8b00708

Browse files
committed
revert to old behavior
1 parent 849a130 commit 8b00708

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

cmd/admin_user_create.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ var microcmdUserCreate = &cli.Command{
4949
},
5050
&cli.BoolFlag{
5151
Name: "must-change-password",
52-
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)",
52+
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)",
5353
DisableDefaultText: true,
5454
},
5555
&cli.IntFlag{
@@ -129,8 +129,8 @@ func runCreateUser(c *cli.Context) error {
129129
if err != nil {
130130
return fmt.Errorf("IsTableNotEmpty: %w", err)
131131
}
132-
if !hasUserRecord && isAdmin {
133-
// if this is the first admin being created, don't force to change password (keep the old behavior)
132+
if !hasUserRecord {
133+
// if this is the first one being created, don't force to change password (keep the old behavior)
134134
mustChangePassword = false
135135
}
136136
}

cmd/admin_user_create_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func TestAdminUserCreate(t *testing.T) {
3030
return createCheck{u.IsAdmin, u.MustChangePassword}
3131
}
3232
reset()
33-
assert.Equal(t, createCheck{IsAdmin: false, MustChangePassword: true}, createUser("u", ""), "first non-admin user must change password")
33+
assert.Equal(t, createCheck{IsAdmin: false, MustChangePassword: true}, createUser("u", ""), "first non-admin user doesn't need to change password")
3434

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

0 commit comments

Comments
 (0)