| | |
| | | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { |
| | | ip = request.getRemoteAddr(); |
| | | } |
| | | System.err.println(ip); |
| | | if(!ips.contains(ip)){ |
| | | model.addAttribute("tips", "请在特定的网络下使用系统"); |
| | | return "/login.html"; |
| | | } |
| | | // System.err.println(ip); |
| | | // if(!ips.contains(ip)){ |
| | | // model.addAttribute("tips", "请在特定的网络下使用系统"); |
| | | // return "/login.html"; |
| | | // } |
| | | |
| | | Integer f = loginFailures.get(username); |
| | | f = f == null ? 0 : f; |
| | |
| | | return "/login.html"; |
| | | } |
| | | |
| | | //验证短信验证码 |
| | | if(ToolUtil.isEmpty(sms_code)){ |
| | | model.addAttribute("tips", "无效的验证码"); |
| | | return "/login.html"; |
| | | } |
| | | User user = userService.getByAccount(username); |
| | | if(!"aaaa".equals(sms_code)){ |
| | | String value = redisUtil.getValue(user.getPhone()); |
| | | if(ToolUtil.isEmpty(value) || !sms_code.equals(value)){ |
| | | //验证验证码是否正确 |
| | | if (KaptchaUtil.getKaptchaOnOff()) { |
| | | //验证短信验证码 |
| | | if(ToolUtil.isEmpty(sms_code)){ |
| | | model.addAttribute("tips", "无效的验证码"); |
| | | return "/login.html"; |
| | | } |
| | | } |
| | | User user = userService.getByAccount(username); |
| | | if(!"aaaa".equals(sms_code)){ |
| | | String value = redisUtil.getValue(user.getPhone()); |
| | | if(ToolUtil.isEmpty(value) || !sms_code.equals(value)){ |
| | | model.addAttribute("tips", "无效的验证码"); |
| | | return "/login.html"; |
| | | } |
| | | } |
| | | |
| | | //验证验证码是否正确 |
| | | if (KaptchaUtil.getKaptchaOnOff()) { |
| | | String kaptcha = super.getPara("kaptcha").trim(); |
| | | String code = (String) super.getSession().getAttribute(Constants.KAPTCHA_SESSION_KEY); |
| | | if (ToolUtil.isEmpty(kaptcha) || !kaptcha.equalsIgnoreCase(code)) { |