1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-31 14:08:06 +08:00

fix: 修改初始化错误返回 (#873)

This commit is contained in:
ssongliu 2023-05-05 11:40:51 +08:00 committed by GitHub
parent f4f83283d3
commit 3ac64d65b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 2 deletions

View File

@ -1,11 +1,11 @@
package service package service
import ( import (
"fmt"
"strconv" "strconv"
"time" "time"
"github.com/1Panel-dev/1Panel/backend/app/dto" "github.com/1Panel-dev/1Panel/backend/app/dto"
"github.com/1Panel-dev/1Panel/backend/buserr"
"github.com/1Panel-dev/1Panel/backend/constant" "github.com/1Panel-dev/1Panel/backend/constant"
"github.com/1Panel-dev/1Panel/backend/global" "github.com/1Panel-dev/1Panel/backend/global"
"github.com/1Panel-dev/1Panel/backend/utils/encrypt" "github.com/1Panel-dev/1Panel/backend/utils/encrypt"
@ -191,5 +191,5 @@ func (u *AuthService) InitUser(c *gin.Context, req dto.InitUser) error {
return nil return nil
} }
return fmt.Errorf("can't init user because user %s is in system", user.Value) return buserr.New(constant.ErrInitUser)
} }

View File

@ -46,6 +46,7 @@ var (
ErrTypeNotSafety = "ErrNotSafety" ErrTypeNotSafety = "ErrNotSafety"
ErrNameIsExist = "ErrNameIsExist" ErrNameIsExist = "ErrNameIsExist"
ErrDemoEnvironment = "ErrDemoEnvironment" ErrDemoEnvironment = "ErrDemoEnvironment"
ErrInitUser = "ErrInitUser"
) )
// app // app

View File

@ -17,6 +17,7 @@ ErrRepoNotValid: "Remote repository verification failed"
ErrNameIsExist: "Name is already exist" ErrNameIsExist: "Name is already exist"
ErrDemoEnvironment: "Demo server, prohibit this operation!" ErrDemoEnvironment: "Demo server, prohibit this operation!"
ErrCmdTimeout: "Command execution timed out" ErrCmdTimeout: "Command execution timed out"
ErrInitUser: "The user initialization has been completed by the system. Please do not repeat the operation!"
#app #app
ErrPortInUsed: "{{ .detail }} port already in use" ErrPortInUsed: "{{ .detail }} port already in use"

View File

@ -17,6 +17,7 @@ ErrRepoNotValid: "远程仓库校验失败!"
ErrNameIsExist: "名称已存在" ErrNameIsExist: "名称已存在"
ErrDemoEnvironment: "演示服务器,禁止此操作!" ErrDemoEnvironment: "演示服务器,禁止此操作!"
ErrCmdTimeout: "命令执行超时!" ErrCmdTimeout: "命令执行超时!"
ErrInitUser: "系统已完成用户初始化,请勿重复操作!"
#app #app
ErrPortInUsed: "{{ .detail }} 端口已被占用!" ErrPortInUsed: "{{ .detail }} 端口已被占用!"