From 6ba32c7b257df0e7f9ef00f77712215ba007da56 Mon Sep 17 00:00:00 2001 From: xiaoWangSec <124417044+xiaoWangSec@users.noreply.github.com> Date: Tue, 12 Sep 2023 04:52:21 +0000 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E6=AC=A1=E5=90=AF=E5=8A=A8=E9=9A=8F?= =?UTF-8?q?=E6=9C=BA=E7=94=9F=E6=88=908=E4=BD=8D=E5=AF=86=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.en.md | 6 ++++-- README.ja.md | 6 ++++-- README.md | 6 ++++-- model/main.go | 5 +++-- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/README.en.md b/README.en.md index 783c140c..bc55c854 100644 --- a/README.en.md +++ b/README.en.md @@ -126,7 +126,9 @@ sudo certbot --nginx sudo service nginx restart ``` -The initial account username is `root` and password is `123456`. +The initial account username is `root` and an 8-character password shall be generated and printed upon initial activation. + +You may need to utilize the command `docker logs CONTAINER` to inspect the password. ### Manual Deployment 1. Download the executable file from [GitHub Releases](https://github.com/songquanpeng/one-api/releases/latest) or compile from source: @@ -148,7 +150,7 @@ The initial account username is `root` and password is `123456`. chmod u+x one-api ./one-api --port 3000 --log-dir ./logs ``` -3. Access [http://localhost:3000/](http://localhost:3000/) and log in. The initial account username is `root` and password is `123456`. +3. Access [http://localhost:3000/](http://localhost:3000/) and log in. The initial account username is `root` and an 8-character password shall be generated and printed upon initial activation. For more detailed deployment tutorials, please refer to [this page](https://iamazing.cn/page/how-to-deploy-a-website). diff --git a/README.ja.md b/README.ja.md index fa3339c2..79d86cf7 100644 --- a/README.ja.md +++ b/README.ja.md @@ -127,7 +127,9 @@ sudo certbot --nginx sudo service nginx restart ``` -初期アカウントのユーザー名は `root` で、パスワードは `123456` です。 +初期アカウントのユーザー名は `root` で、初回起動時には、8桁のパスワードが生成され、印刷されます。 + +パスワードを確認するためには、`docker logs CONTAINER`コマンドを使用する必要があります。 ### マニュアルデプロイ 1. [GitHub Releases](https://github.com/songquanpeng/one-api/releases/latest) から実行ファイルをダウンロードする、もしくはソースからコンパイルする: @@ -149,7 +151,7 @@ sudo service nginx restart chmod u+x one-api ./one-api --port 3000 --log-dir ./logs ``` -3. [http://localhost:3000/](http://localhost:3000/) にアクセスし、ログインする。初期アカウントのユーザー名は `root`、パスワードは `123456` である。 +3. [http://localhost:3000/](http://localhost:3000/) にアクセスし、ログインする。初期アカウントのユーザー名は `root`、初回起動時には、8桁のパスワードが生成され、印刷されます。 より詳細なデプロイのチュートリアルについては、[このページ](https://iamazing.cn/page/how-to-deploy-a-website) を参照してください。 diff --git a/README.md b/README.md index b89c6be8..3eaad0d0 100644 --- a/README.md +++ b/README.md @@ -147,7 +147,9 @@ sudo certbot --nginx sudo service nginx restart ``` -初始账号用户名为 `root`,密码为 `123456`。 +初始账号用户名为 `root`,8位密码将会在初次启动时生成并打印出来。 + +您可能会需要使用`docker logs CONTAINER`命令来查看密码。 ### 手动部署 1. 从 [GitHub Releases](https://github.com/songquanpeng/one-api/releases/latest) 下载可执行文件或者从源码编译: @@ -169,7 +171,7 @@ sudo service nginx restart chmod u+x one-api ./one-api --port 3000 --log-dir ./logs ``` -3. 访问 [http://localhost:3000/](http://localhost:3000/) 并登录。初始账号用户名为 `root`,密码为 `123456`。 +3. 访问 [http://localhost:3000/](http://localhost:3000/) 并登录。初始账号用户名为 `root`,8位密码将会在初次启动时生成并打印出来。 更加详细的部署教程[参见此处](https://iamazing.cn/page/how-to-deploy-a-website)。 diff --git a/model/main.go b/model/main.go index d422c4e0..fa1b5cd6 100644 --- a/model/main.go +++ b/model/main.go @@ -17,8 +17,9 @@ func createRootAccountIfNeed() error { var user User //if user.Status != common.UserStatusEnabled { if err := DB.First(&user).Error; err != nil { - common.SysLog("no user exists, create a root user for you: username is root, password is 123456") - hashedPassword, err := common.Password2Hash("123456") + pwd := common.GetRandomString(8) + common.SysLog("no user exists, create a root user for you: username is root, password is " + pwd) + hashedPassword, err := common.Password2Hash(pwd) if err != nil { return err }