summaryrefslogtreecommitdiffstats
path: root/cmd/admin.go
diff options
context:
space:
mode:
authorLanre Adelowo <adelowomailbox@gmail.com>2018-11-25 08:42:24 +0100
committerLauris BH <lauris@nix.lv>2018-11-25 09:42:24 +0200
commitfd37fb01fdb75ba7555424b37b3b92721ae30698 (patch)
tree420e588a2ec6b3c7d9179d852d190ab7a95e725d /cmd/admin.go
parent3379141d818804aa8f7143ef32bd538c7e4ce795 (diff)
downloadgitea-fd37fb01fdb75ba7555424b37b3b92721ae30698.tar.gz
gitea-fd37fb01fdb75ba7555424b37b3b92721ae30698.zip
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
Diffstat (limited to 'cmd/admin.go')
-rw-r--r--cmd/admin.go6
1 files changed, 6 insertions, 0 deletions
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")
}