From 7d44157f9729532ff8fac642a12e951a3f5bd3b6 Mon Sep 17 00:00:00 2001 From: Lanre Adelowo Date: Fri, 23 Nov 2018 17:55:03 +0100 Subject: [PATCH 1/2] don't force a password change for the admin user --- cmd/admin.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/admin.go b/cmd/admin.go index d8acce778881..551d48e1a141 100644 --- a/cmd/admin.go +++ b/cmd/admin.go @@ -326,6 +326,12 @@ func runCreateUser(c *cli.Context) error { changePassword = c.Bool("must-change-password") } + // If this is the first user being created. + // Take it as the admin and don't force a password update. + if n := models.CountUsers(); n == 0 { + changePassword = false + } + if err := models.CreateUser(&models.User{ Name: c.String("name"), Email: c.String("email"), From bd3efbdcd4c83db190aa54fdef16e3d699c1058c Mon Sep 17 00:00:00 2001 From: Lanre Adelowo Date: Sun, 25 Nov 2018 08:22:28 +0100 Subject: [PATCH 2/2] 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 --- cmd/admin.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/admin.go b/cmd/admin.go index 551d48e1a141..9422e507099e 100644 --- a/cmd/admin.go +++ b/cmd/admin.go @@ -322,16 +322,16 @@ func runCreateUser(c *cli.Context) error { // always default to true var changePassword = true - if c.IsSet("must-change-password") { - changePassword = c.Bool("must-change-password") - } - // If this is the first user being created. // Take it as the admin and don't force a password update. if n := models.CountUsers(); n == 0 { changePassword = false } + if c.IsSet("must-change-password") { + changePassword = c.Bool("must-change-password") + } + if err := models.CreateUser(&models.User{ Name: c.String("name"), Email: c.String("email"),