From ec334239e08a755c9ff5d9c461bf456d498256b8 Mon Sep 17 00:00:00 2001
From: Earl Warren <contact@earl-warren.org>
Date: Wed, 24 Apr 2024 12:27:20 +0200
Subject: [PATCH] fix(cli): admin user create first user never require a
 password change

Fixes: https://codeberg.org/forgejo/forgejo/issues/3399
---
 RELEASE-NOTES.md         | 1 +
 cmd/admin_user_create.go | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md
index 9a1c19632d..65146b950f 100644
--- a/RELEASE-NOTES.md
+++ b/RELEASE-NOTES.md
@@ -11,6 +11,7 @@ This is a bug fix release. See the documentation for more information on the [up
 In addition to the following notable bug fixes, you can browse the [full list of commits](https://codeberg.org/forgejo/forgejo/compare/v7.0.0...v7.0.1) included in this release.
 
 * **Bug fixes:**
+  * The regression in the [`fogejo admin user create`](https://forgejo.org/docs/v7.0/admin/command-line/#admin-user-create) CLI command [is fixed](https://codeberg.org/forgejo/forgejo/issues/3399) and it is backward compatible.
 
 ## 7.0.0
 
diff --git a/cmd/admin_user_create.go b/cmd/admin_user_create.go
index caafef536c..dfc484aeb2 100644
--- a/cmd/admin_user_create.go
+++ b/cmd/admin_user_create.go
@@ -124,7 +124,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
 		}