| | |
| | | * @date 2022/03/15 09:54 |
| | | */ |
| | | @Override |
| | | protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException{ |
| | | protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException { |
| | | // 获取用户名 |
| | | String username = authenticationToken.getPrincipal().toString(); |
| | | // 根据用户名查询用户对象 |
| | |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,账号或密码不正确!"); |
| | | } |
| | | if(Objects.equals(user.getStatus(),Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"用户已被禁用,请联系管理员"); |
| | | throw new AuthenticationException("用户已被禁用,请联系管理员"); |
| | | } |
| | | // 获取登录用户信息 |
| | | List<SystemRole> roles = systemRoleService.findByUserId(user.getId()); |
| | |
| | | loginLog.setReason(e.getMessage().length() > 200 ? (e.getMessage().substring(0, 190) + "...") : e.getMessage()); |
| | | loginLog.setSuccess(Constants.ONE); |
| | | systemLoginLogService.create(loginLog); |
| | | throw new BusinessException(ResponseStatus.ACCOUNT_INCORRECT); |
| | | throw new BusinessException(ResponseStatus.ACCOUNT_INCORRECT.getCode(),e.getMessage()); |
| | | } |
| | | } |
| | | |