初次启动随机生成8位密码

This commit is contained in:
xiaoWangSec 2023-09-12 04:52:21 +00:00
parent d0a0e871e1
commit 6ba32c7b25
4 changed files with 15 additions and 8 deletions

View File

@ -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).

View File

@ -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) を参照してください。

View File

@ -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)。

View File

@ -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
}