| | |
| | | import com.stylefeng.guns.modular.system.service.IMenuService; |
| | | import com.stylefeng.guns.modular.system.service.IUserService; |
| | | import com.stylefeng.guns.modular.system.util.AESUtils; |
| | | import com.stylefeng.guns.modular.system.util.RedisUtil; |
| | | import org.apache.shiro.authc.SimpleAuthenticationInfo; |
| | | import org.apache.shiro.authc.UsernamePasswordToken; |
| | | import org.apache.shiro.subject.Subject; |
| | |
| | | |
| | | @Autowired |
| | | private IUserService userService; |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | private Map<String, Integer> loginFailures = new HashMap<>(); |
| | | |
| | |
| | | * 点击登录执行的动作 |
| | | */ |
| | | @RequestMapping(value = "/login", method = RequestMethod.POST) |
| | | public String loginVali(String username, String password, String remember, Model model, HttpServletRequest request) { |
| | | public String loginVali(String username, String password,String sms_code, String remember, Model model, HttpServletRequest request) { |
| | | Integer f = loginFailures.get(username); |
| | | f = f == null ? 0 : f; |
| | | // 校验账号,密码是否正确,如果错误,对次数进行加1 |
| | |
| | | return "/login.html"; |
| | | } |
| | | } |
| | | |
| | | // 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)) { |
| | | throw new InvalidKaptchaException(); |
| | | } |
| | | } |
| | | |
| | | model.addAttribute("number", "3"); |
| | | Subject currentUser = ShiroKit.getSubject(); |
| | | UsernamePasswordToken token = new UsernamePasswordToken(username, password.toCharArray()); |