去掉登录控制器不需要的东西

This commit is contained in:
xuetao.li
2023-04-17 20:36:34 +08:00
parent 3557015f15
commit 2aac156e38
@@ -89,24 +89,15 @@ public class LoginRestController {
*/
private static final String LOGIN_FAIL_MAP = "loginFailMap";
/**
* 服务层装配
*
* @see UserEOService
*/
@Resource
private IUserEoService userService;
@Resource
private SystemAuthorizingRealm systemAuthorizingRealm;
@Resource
private UserEODao userEODao;
/**
* eo vo 转换
*
@@ -330,8 +321,6 @@ public class LoginRestController {
subject.login(token);
//认证完成删除session中VerifyCode
request.getSession().removeAttribute("VerifyCode");
//认证成功将库里错误次数改为0
// userService.updatePasswordErrorsNumberByAccount(username,0);
userEO = UserUtils.getUser();
request.getSession().setAttribute(RequestUtils.LOGIN_USER, userEO);
@@ -353,7 +342,6 @@ public class LoginRestController {
}
//注销原session,为的是重置sessionId
//session.invalidate();
subject.logout();
//将临时map中的数据转移至新session
@@ -363,7 +351,6 @@ public class LoginRestController {
}
System.out.println(session.getId());
// Session session = subject.getSession();
if (null != session) {
CacheUtils.putShiroSessionCache(userEO.getUsid(), session.getId());
}
@@ -371,21 +358,15 @@ public class LoginRestController {
return Result.success(beanMapper.map(returnEO, UserVO.class));
} catch (CaptchaException e) {
// systemAuthorizingRealm.increaseLoginErrorCount(username);
log.info("验证码验证失败");
return Result.error("r0012", "您输入的验证码不正确", systemAuthorizingRealm.isNeedValidCode(username));
} catch (UnknownAccountException e) {
// systemAuthorizingRealm.increaseLoginErrorCount(username);
log.info("用户[{}]身份验证失败", username);
return Result.error("r0011", "您输入的帐号或密码有误", systemAuthorizingRealm.isNeedValidCode(username));
} catch (IncorrectCredentialsException e) {
// systemAuthorizingRealm.increaseLoginErrorCount(username);
log.info("用户[{}]密码验证失败", username);
//增加错误次数
// return passwordErrorsNumber(username);
return Result.error("r0011", "您输入的帐号或密码有误", systemAuthorizingRealm.isNeedValidCode(username));
} catch (Exception e) {
// systemAuthorizingRealm.increaseLoginErrorCount(username);
log.error(e.getMessage(), e);
return Result.error("r0013", e.getMessage(), systemAuthorizingRealm.isNeedValidCode(username));
}