| | |
| | | package com.fzzy.web; |
| | | |
| | | import com.fzzy.sys.LogLoginService; |
| | | import com.fzzy.sys.UserPR; |
| | | import com.fzzy.sys.entity.SysUser; |
| | | import com.wf.captcha.ArithmeticCaptcha; |
| | |
| | | |
| | | @Autowired |
| | | private UserPR userPR; |
| | | @Autowired |
| | | private LogLoginService logLoginService; |
| | | |
| | | /** |
| | | * 登录验证入口 |
| | |
| | | return "redirect:/login?tag=04&username=" + username; |
| | | } |
| | | |
| | | //判断限制登陆 |
| | | int num = logLoginService.checkLoginLimit(request, username); |
| | | if (num >= 3) { |
| | | return "redirect:/login?tag=11&username=" + username; |
| | | } |
| | | |
| | | SysUser user = userPR.listById(username); |
| | | if (null == user) { |
| | | num = logLoginService.addNoUser(request, username); |
| | | if (num >= 3) { |
| | | return "redirect:/login?tag=12&username=" + username; |
| | | } |
| | | return "redirect:/login?tag=05&username=" + username; |
| | | } |
| | | |
| | | boolean tag = userPR.checkPassword(password, user); |
| | | if (!tag){ |
| | | num = logLoginService.addPwdError(request, user); |
| | | if (num >= 3) { |
| | | return "redirect:/login?tag=11&username=" + username; |
| | | } |
| | | return "redirect:/login?tag=06&username=" + username; |
| | | } |
| | | request.getSession().setAttribute("user", user); |
| | | //增加登录日志 |
| | | logLoginService.addLoginInfo(request, user); |
| | | |
| | | return "redirect:/home"; |
| | | } |
| | |
| | | if ("10".equals(tag)) { |
| | | tag = "您的账号在其他地方登录,被迫下线"; |
| | | } |
| | | if ("11".equals(tag)) { |
| | | tag = "连续3次错误,限制登陆60分钟"; |
| | | } |
| | | if ("12".equals(tag)) { |
| | | tag = "连续3次输入不存在账号,限制登陆60分钟"; |
| | | } |
| | | view.addObject("TAG", tag); |
| | | view.addObject("USERNAME", username); |
| | | } |