From: Lanre Adelowo Date: Sun, 25 Nov 2018 07:42:24 +0000 (+0100) Subject: Don't force a password change for the admin user when creating an account via cli... X-Git-Tag: v1.7.0-dev~98 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=fd37fb01fdb75ba7555424b37b3b92721ae30698;p=gitea.git 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 --- diff --git a/cmd/admin.go b/cmd/admin.go index d8acce7788..9422e50709 100644 --- a/cmd/admin.go +++ b/cmd/admin.go @@ -322,6 +322,12 @@ func runCreateUser(c *cli.Context) error { // always default to true var changePassword = true + // 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") }