fix(user): show admin password on first start (#883)

* fix: fix admin password not shown in first start
* chore: add time dependence

Co-authored-by: Yinan Qin <39023210+elysia-best@users.noreply.github.com>
Signed-off-by: ILoveScratch <ilovescratch@foxmail.com>

* fix: fix log format

Co-authored-by: Yinan Qin <39023210+elysia-best@users.noreply.github.com>
Signed-off-by: ILoveScratch <ilovescratch@foxmail.com>

---------

Signed-off-by: ILoveScratch <ilovescratch@foxmail.com>
Co-authored-by: Yinan Qin <39023210+elysia-best@users.noreply.github.com>
This commit is contained in:
ILoveScratch
2025-07-29 21:36:27 +08:00
committed by GitHub
parent 11cf561307
commit d6867b4ab6

View File

@ -1,6 +1,8 @@
package data
import (
"fmt"
"time"
"os"
"github.com/OpenListTeam/OpenList/v4/cmd/flags"
@ -39,6 +41,7 @@ func initUser() {
panic(err)
} else {
utils.Log.Infof("Successfully created the admin user and the initial password is: %s", adminPassword)
fmt.Printf("\033[36mINFO\033[39m[%s] Successfully created the admin user and the initial password is: %s\n", time.Now().Format("2006-01-02 15:04:05"), adminPassword)
}
} else {
utils.Log.Fatalf("[init user] Failed to get admin user: %v", err)