Compare commits
4 Commits
27593d84d0
...
31b5a89329
Author | SHA1 | Date |
---|---|---|
|
31b5a89329 | |
|
64979345f5 | |
|
5639d54a5f | |
|
516aebfba0 |
|
@ -52,7 +52,7 @@ spring:
|
|||
# 国际化资源文件路径
|
||||
basename: i18n/messages
|
||||
profiles:
|
||||
active: druid
|
||||
active: dev
|
||||
# 文件上传
|
||||
servlet:
|
||||
multipart:
|
||||
|
|
|
@ -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);
|
||||
// 生成100000到999999之间的随机整数(包括100000和999999)
|
||||
int captcha = 100000 + random.nextInt(900000);
|
||||
// 将整数转换为字符串并返回
|
||||
return String.valueOf(captcha);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue