style: 错误提示英文内容
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"ems.agt/src/framework/constants/cachekey"
|
||||
@@ -37,16 +36,16 @@ func (s *RegisterImpl) ValidateCaptcha(code, uuid string) error {
|
||||
return nil
|
||||
}
|
||||
if code == "" || uuid == "" {
|
||||
return errors.New("验证码信息错误")
|
||||
return fmt.Errorf("verification code information error")
|
||||
}
|
||||
verifyKey := cachekey.CAPTCHA_CODE_KEY + uuid
|
||||
captcha, err := redis.Get("", verifyKey)
|
||||
if err != nil {
|
||||
return errors.New("验证码已失效")
|
||||
return fmt.Errorf("the verification code has expired")
|
||||
}
|
||||
redis.Del("", verifyKey)
|
||||
if captcha != code {
|
||||
return errors.New("验证码错误")
|
||||
return fmt.Errorf("verification code error")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -57,13 +56,13 @@ func (s *RegisterImpl) ByUserName(username, password, userType string) (string,
|
||||
registerUserStr := s.sysConfigService.SelectConfigValueByKey("sys.account.registerUser")
|
||||
captchaEnabled := parse.Boolean(registerUserStr)
|
||||
if !captchaEnabled {
|
||||
return "", fmt.Errorf("注册用户【%s】失败,很抱歉,系统已关闭外部用户注册通道", username)
|
||||
return "", fmt.Errorf("failed to register user [%s]. Sorry, the system has closed the external user registration channel", username)
|
||||
}
|
||||
|
||||
// 检查用户登录账号是否唯一
|
||||
uniqueUserName := s.sysUserService.CheckUniqueUserName(username, "")
|
||||
if !uniqueUserName {
|
||||
return "", fmt.Errorf("注册用户【%s】失败,注册账号已存在", username)
|
||||
return "", fmt.Errorf("failed to register user [%s], registered account already exists", username)
|
||||
}
|
||||
|
||||
sysUser := systemModel.SysUser{
|
||||
@@ -72,7 +71,7 @@ func (s *RegisterImpl) ByUserName(username, password, userType string) (string,
|
||||
Password: password, // 原始密码
|
||||
Status: common.STATUS_YES, // 账号状态激活
|
||||
DeptID: "100", // 归属部门为根节点
|
||||
CreateBy: "注册", // 创建来源
|
||||
CreateBy: "register", // 创建来源
|
||||
}
|
||||
// 标记用户类型
|
||||
if userType == "" {
|
||||
@@ -87,7 +86,7 @@ func (s *RegisterImpl) ByUserName(username, password, userType string) (string,
|
||||
if insertId != "" {
|
||||
return insertId, nil
|
||||
}
|
||||
return "", fmt.Errorf("注册用户【%s】失败,请联系系统管理人员", username)
|
||||
return "", fmt.Errorf("failed to register user [%s]. Please contact the system administrator", username)
|
||||
}
|
||||
|
||||
// registerRoleInit 注册初始角色
|
||||
|
||||
Reference in New Issue
Block a user