Merge branch 'refs/heads/preview' into feature/community-center

feature/admin
yang 2025-04-26 13:41:22 +08:00
commit 31b5a89329
3 changed files with 7 additions and 3 deletions

View File

@ -52,7 +52,7 @@ spring:
# 国际化资源文件路径
basename: i18n/messages
profiles:
active: druid
active: dev
# 文件上传
servlet:
multipart:

View File

@ -20,8 +20,8 @@ public class CodeUtils {
public static String generateCaptcha() {
// 创建Random对象用于生成随机数
Random random = new Random();
// 生成1000到9999之间的随机整数包括1000和9999
int captcha = 1000 + random.nextInt(9000);
// 生成100000999999之间的随机整数包括100000999999
int captcha = 100000 + random.nextInt(900000);
// 将整数转换为字符串并返回
return String.valueOf(captcha);
}

View File

@ -41,6 +41,7 @@ public class UserDetailsServiceImpl implements UserDetailsService, OtherUserDeta
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
SysUser user = null;
log.info("当前num:{}",num);
if (num == 0 ){
user = userService.selectUserByUserName(username);
}else {
@ -49,11 +50,14 @@ public class UserDetailsServiceImpl implements UserDetailsService, OtherUserDeta
if (StringUtils.isNull(user)) {
log.info("登录用户:{} 不存在.", username);
num = 0;
throw new ServiceException(MessageUtils.message("user.not.exists"), HttpStatus.SHOW_ERROR_MSG);
} else if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) {
num = 0;
log.info("登录用户:{} 已被删除.", username);
throw new ServiceException(MessageUtils.message("user.password.delete"), HttpStatus.SHOW_ERROR_MSG);
} else if (UserStatus.DISABLE.getCode().equals(user.getStatus())) {
num = 0;
log.info("登录用户:{} 已被停用.", username);
throw new ServiceException(MessageUtils.message("user.blocked"), HttpStatus.SHOW_ERROR_MSG);
}