app登录校验

This commit is contained in:
wanggeng 2022-05-07 14:34:45 +08:00
parent cc78d40b9d
commit c4056bfcb3

View File

@ -62,18 +62,6 @@ public class AppSignServiceImpl extends BaseAppSignService implements IAppSignSe
if (userPO == null) {
throw new SearchException("用户不存在");
}
if (userPO.getUserState() == UserStateEnum.UN_EXAMINE.getValue()) {
throw new SearchException("用户未审核");
}
if (userPO.getUserState() == UserStateEnum.UN_PASS.getValue()) {
throw new SearchException("用户审核未通过");
}
if (userPO.getUserState() == UserStateEnum.LOCK.getValue()) {
throw new SearchException("用户已锁定");
}
if (DateUtil.isDateExpired(userPO.getUserExpiredDate())) {
throw new UserAuthenticationException("账号已经过期");
}
if (!passwordEncoder.matches(userPassword, userPO.getUserPassword())) {
throw new SearchException("用户名或密码错误");
}
@ -98,11 +86,17 @@ public class AppSignServiceImpl extends BaseAppSignService implements IAppSignSe
* @param userPO
*/
private void userLogin(AppLoginVO appLoginVO, UserPO userPO) throws Exception {
if (userPO.getUserState() == 1) {
throw new SearchException("账号已冻结");
if (userPO.getUserState() == UserStateEnum.UN_EXAMINE.getValue()) {
throw new SearchException("用户未审核");
}
if (userPO.getUserState() == 2) {
throw new SearchException("账号已锁定");
if (userPO.getUserState() == UserStateEnum.UN_PASS.getValue()) {
throw new SearchException("用户审核未通过");
}
if (userPO.getUserState() == UserStateEnum.LOCK.getValue()) {
throw new SearchException("用户已锁定");
}
if (DateUtil.isDateExpired(userPO.getUserExpiredDate())) {
throw new UserAuthenticationException("账号已经过期");
}
LOG.debug("校验设备");
if (!StringUtils.isBlank(appLoginVO.getDeviceNo()) && !appDeviceUserService.canSign(userPO.getUserId(), appLoginVO.getDeviceNo())) {