style: 错误信息英文返回-lib包

This commit is contained in:
TsMask
2023-11-08 15:00:54 +08:00
parent 81138b8c22
commit c53cd9ce16
6 changed files with 48 additions and 51 deletions

View File

@@ -820,12 +820,13 @@ func XormCheckLoginUser(name, password, cryptArgo string) (bool, *User, error) {
return false, nil, err
}
if oauth.BcryptCompare(user.Password, password) != nil {
err := errors.New("用户名或密码错误")
err := errors.New("Incorrect user name or password")
log.Error(err)
// 记录错误
errCoutn := pwdErrCountAdd(user.AccountId, user.Profile, false)
if errCoutn > 3 {
return false, nil, errors.New("登录失败次数过多请30分钟后重试")
// 登录失败次数过多请30分钟后重试
return false, nil, errors.New("Login failed too many times, please retry after 30 minutes")
}
return false, nil, err
}
@@ -841,9 +842,9 @@ func XormCheckLoginUser(name, password, cryptArgo string) (bool, *User, error) {
errMsg := ""
switch user.Status {
case "Closed":
errMsg = "账户已禁用"
errMsg = "Account disabled" // 账户已禁用
case "Locked":
errMsg = "账户已锁定"
errMsg = "Account locked" // 账户已锁定
case "Pending":
// errMsg = "账户已挂起"
_, err := xEngine.Exec("UPDATE user SET status = 'Active' WHERE account_id = ?", user.AccountId)
@@ -865,7 +866,7 @@ func XormCheckLoginUser(name, password, cryptArgo string) (bool, *User, error) {
return false, nil, err
}
if t.Before(time.Now()) {
errMsg := "密码到期时间"
errMsg := "Password expiration time" // 密码到期时间
// 读取配置信息
result, err := XormGetConfig("Security", "pwdStrong")
if err != nil {
@@ -893,7 +894,7 @@ func XormCheckLoginUser(name, password, cryptArgo string) (bool, *User, error) {
return false, nil, err
}
if t.Before(time.Now()) {
errMsg := "用户账户到期"
errMsg := "User account expiration" // 用户账户到期
log.Error("UserExpiration:%s", errMsg)
return false, nil, errors.New(errMsg)
}