| | |
| | | if (YamlProperties.fontDynamicCodeSwitch.toLowerCase(Locale.ENGLISH).equals("true")) { |
| | | String fontDynamicCode = (String) ActionUtil.getSession().getAttribute("fontDynamicCode"); |
| | | if (fontDynamicCode == null || "".equals(fontDynamicCode)) { |
| | | return response.set(1, false, MessageUtils.getMessage("RefreshVerification")); |
| | | return response.set(1, false, "请刷新验证码"); |
| | | } |
| | | if (!deliveredCode.equals(fontDynamicCode.toUpperCase(Locale.ENGLISH))) { |
| | | return response.set(1, false, MessageUtils.getMessage("VerificationError")); |
| | | return response.set(1, false, "验证码错误"); |
| | | } |
| | | } |
| | | } |
| | |
| | | String[] dataArr = RSAUtil.decryptFront(pwd, RSAUtil.fontSeparator); |
| | | //验签md5 |
| | | if (!dataArr[1].equals(ActionUtil.EncryptionMD5(org.apache.commons.lang3.StringUtils.trim(dataArr[0])).toString())) { |
| | | return response.set(1, false, MessageUtils.getMessage("PasswordVerificationFailed")); |
| | | return response.set(1, false, "密码验签失败"); |
| | | } |
| | | UsernamePasswordToken userToken = new UsernamePasswordToken(userName, dataArr[0]); |
| | | Subject subject = SecurityUtils.getSubject(); |
| | |
| | | |
| | | //查询账号状态 |
| | | if(userInf == null){ |
| | | return response.set(1,false,MessageUtils.getMessage("AccountOrPasswordError")); |
| | | return response.set(1,false,"账号或密码错误"); |
| | | } |
| | | if (userInf.getStatus() != 1) { |
| | | switch (userInf.getStatus()) { |
| | | case 0: |
| | | response.setMsg(MessageUtils.getMessage("AccountException") + ": " + UserConstant.ACCOUNT_STATUS_CANCEL.getLabel()); |
| | | response.setMsg("当前账号的状态异常,无法登录. 异常信息为" + ": " + UserConstant.ACCOUNT_STATUS_CANCEL.getLabel()); |
| | | break; |
| | | case 2: |
| | | response.setMsg(MessageUtils.getMessage("AccountException") + ": " + UserConstant.ACCOUNT_STATUS_HIBERNATE.getLabel()); |
| | | response.setMsg("当前账号的状态异常,无法登录. 异常信息为" + ": " + UserConstant.ACCOUNT_STATUS_HIBERNATE.getLabel()); |
| | | break; |
| | | case 3: |
| | | response.setMsg(MessageUtils.getMessage("AccountException") + ": " + UserConstant.ACCOUNT_STATUS_LOCK.getLabel()); |
| | | response.setMsg("当前账号的状态异常,无法登录. 异常信息为" + ": " + UserConstant.ACCOUNT_STATUS_LOCK.getLabel()); |
| | | break; |
| | | case 4: |
| | | response.setMsg(MessageUtils.getMessage("AccountException") + ": " + UserConstant.ACCOUNT_STATUS_LOCK_FAIL.getLabel()); |
| | | response.setMsg("当前账号的状态异常,无法登录. 异常信息为" + ": " + UserConstant.ACCOUNT_STATUS_LOCK_FAIL.getLabel()); |
| | | break; |
| | | default: |
| | | response.setMsg(MessageUtils.getMessage("AccountException") + ": " + MessageUtils.getMessage("Nothing")); |
| | | response.setMsg("当前账号的状态异常,无法登录. 异常信息为:无" ); |
| | | } |
| | | return response.set(1, false); |
| | | } |
| | |
| | | } |
| | | } |
| | | if (!ipPass) { |
| | | return response.set(1, false, MessageUtils.getMessage("IPProhibition")); |
| | | return response.set(1, false, "您的IP禁止访问,请知晓"); |
| | | } |
| | | } else { |
| | | return response.set(1, false, MessageUtils.getMessage("LoginOutOfAllowed")); |
| | | return response.set(1, false,"登录时间不在允许的时间范围内"); |
| | | } |
| | | //首次登录,密码修改;超过3个月未修改密码,强制修改密码 |
| | | Date passwordUpdateTime = userInf.getPasswordUpdateTime(); |
| | |
| | | servletContext.setAttribute(userName + "_login_fail_times_" + System.currentTimeMillis(), 0); |
| | | } |
| | | // CommonUtil.record(0, UserOperation.TYPE_LOGIN_FAIL.getType(), UserOperation.TYPE_LOGIN_FAIL.getTypeName(), UserOperation.TYPE_LOGIN_FAIL.getTypeNameEn()); |
| | | return response.set(1, false, MessageUtils.getMessage("AccountOrPasswordError")); |
| | | return response.set(1, false, "账号或密码错误"); |
| | | }else if(e instanceof AuthenticationException){ |
| | | return response.set(1, false, "密码解析失败"); |
| | | } |
| | |
| | | dataList.add(subject.getPrincipal()); |
| | | PermitgroupUsr permitGroup = permitGroupUserService.getPermitGroup(userInf.getId()); |
| | | if(permitGroup == null){ |
| | | return response.set(1, false, MessageUtils.getMessage("userNoPermitGroup")); |
| | | return response.set(1, false, "当前用户没有对应的权限组,登录失败"); |
| | | }else { |
| | | int permitGroupId = permitGroup.getPermitGroupId(); |
| | | dataList.add(permitGroupId); |
| | |
| | | //查询用户对应的班组标识 |
| | | dataList.add(bjService.getGroupFlag(userInf.getId().intValue())); |
| | | // CommonUtil.record(((User) subject.getPrincipal()).getId(), UserOperation.TYPE_LOGIN.getType(), UserOperation.TYPE_LOGIN.getTypeName(), UserOperation.TYPE_LOGIN.getTypeNameEn()); |
| | | return response.setII(1, true, dataList, MessageUtils.getMessage("LoginSucceeded")); |
| | | return response.setII(1, true, dataList, "登录成功"); |
| | | } |
| | | return response.set(1, false, MessageUtils.getMessage("AuthenticationFailed")); |
| | | return response.set(1, false,"认证未通过"); |
| | | } |
| | | |
| | | |