puzhibing
2023-11-28 3c12858927ce26f277ba758e520c81be599d8df1
cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/system/LoginController.java
@@ -80,26 +80,26 @@
    public String updatePassword(Model model) {
        return "/password.html" ;
    }
    @Autowired
    private RedisUtil redisUtil;
    /**
     * 点击登录执行的动作
     */
    @RequestMapping(value = "/updatePassword", method = RequestMethod.POST)
    public Object loginVali(String username, String password,String code) {
        User user = userService.getByAccount(username);
        if (user==null)return "用户不存在";
        password = AESUtils.decrypt(password);
        String s = MD5.md5(password);
        if(user.getPassword().equals(s))return "新密码和旧密码一致";
        //验证短信验证码
        if(ToolUtil.isEmpty(code))return "无效的验证码";
        String value = redisUtil.getValue(user.getPhone());
        if(ToolUtil.isEmpty(value) || !code.equals(value))return "手机验证码不正确";
        user.setPassword(s);
        return "修改成功!";
    }
//    @Autowired
//    private RedisUtil redisUtil;
//    /**
//     * 点击登录执行的动作
//     */
//    @RequestMapping(value = "/updatePassword", method = RequestMethod.POST)
//    public Object loginVali(String username, String password,String code) {
//
//        User user = userService.getByAccount(username);
//        if (user==null)return "用户不存在";
//        password = AESUtils.decrypt(password);
//        String s = MD5.md5(password);
//        if(user.getPassword().equals(s))return "新密码和旧密码一致";
//        //验证短信验证码
//        if(ToolUtil.isEmpty(code))return "无效的验证码";
//        String value = redisUtil.getValue(user.getPhone());
//        if(ToolUtil.isEmpty(value) || !code.equals(value))return "手机验证码不正确";
//        user.setPassword(s);
//        return "修改成功!";
//    }
    /**
     * 跳转到主页
     */
@@ -227,14 +227,7 @@
            f++;
            loginFailures.put(username, f);
        }
        if (KaptchaUtil.getKaptchaOnOff()) {
            String kaptcha = super.getPara("kaptcha").trim();
            String code = (String) super.getSession().getAttribute(Constants.KAPTCHA_SESSION_KEY);
            if (Objects.isNull(kaptcha) || !kaptcha.equalsIgnoreCase(code)) {
                model.addAttribute("tips", "验证码错误");
                return "/login.html";
            }
        }
//        if (f > 5 && (System.currentTimeMillis() - t) <= (30 * 60 * 1000)) {
//            model.addAttribute("tips", "登录次数过多,请等30分钟再试!");
//            return "/login.html";