2
0

feat: add i18n

This commit is contained in:
caiyuchao
2024-11-25 19:22:30 +08:00
parent 887db97ea3
commit 77a28b06a3
18 changed files with 347 additions and 25 deletions

View File

@@ -48,7 +48,7 @@ public class SysLoginService
if (StringUtils.isAnyBlank(username, password))
{
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户/密码必须填写");
throw new ServiceException("用户/密码必须填写");
throw new ServiceException("user.password.not.blank");
}
// 密码如果不在指定范围内 错误
if (password.length() < UserConstants.PASSWORD_MIN_LENGTH
@@ -132,7 +132,7 @@ public class SysLoginService
// 用户名或密码为空 错误
if (StringUtils.isAnyBlank(username, password))
{
throw new ServiceException("用户/密码必须填写");
throw new ServiceException("user.password.not.blank");
}
if (username.length() < UserConstants.USERNAME_MIN_LENGTH
|| username.length() > UserConstants.USERNAME_MAX_LENGTH)

View File

@@ -1,15 +1,17 @@
package org.wfc.auth.service;
import java.util.concurrent.TimeUnit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.wfc.common.core.constant.CacheConstants;
import org.wfc.common.core.constant.Constants;
import org.wfc.common.core.exception.ServiceException;
import org.wfc.common.core.exception.user.UserPasswordNotMatchException;
import org.wfc.common.redis.service.RedisService;
import org.wfc.common.security.utils.SecurityUtils;
import org.wfc.system.api.domain.SysUser;
import java.util.concurrent.TimeUnit;
/**
* 登录密码方法
*
@@ -62,7 +64,7 @@ public class SysPasswordService
retryCount = retryCount + 1;
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, String.format("密码输入错误%s次", retryCount));
redisService.setCacheObject(getCacheKey(username), retryCount, lockTime, TimeUnit.MINUTES);
throw new ServiceException("用户不存在/密码错误");
throw new UserPasswordNotMatchException();
}
else
{