From 8050b6f4c162988ff0ae6d3fcc22aa0990ae0e4f Mon Sep 17 00:00:00 2001
From: nickchange <126672920+nickchange@users.noreply.github.com>
Date: 星期五, 01 十二月 2023 18:01:36 +0800
Subject: [PATCH] 12.1

---
 cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/system/LoginController.java |   73 ++++++++++++++++++++++--------------
 1 files changed, 45 insertions(+), 28 deletions(-)

diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/system/LoginController.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/system/LoginController.java
index 2b8a8d2..1842ca3 100644
--- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/system/LoginController.java
+++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/system/LoginController.java
@@ -32,6 +32,7 @@
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
 
 import javax.activation.MailcapCommandMap;
 import javax.annotation.Resource;
@@ -76,30 +77,53 @@
     /**
      * 跳转到修改密码页面
      */
-    @PostMapping("/update")
+    @RequestMapping(value = "/update", method = RequestMethod.GET)
     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 "修改成功!";
-    }
+
+//    // todo 短信验证码
+//    @ResponseBody
+//    @PostMapping("/getSMSCode")
+//    public String getSMSCode( String phone) {
+//        if (ToolUtil.isEmpty(phone)) {
+//            return ResultUtil.paranErr("phone");
+//        }
+//        if (ToolUtil.isEmpty(type)) {
+//            return ResultUtil.paranErr("type");
+//        }
+////        try {
+//            String smsCode = appUserClient.getSMSCode(phone);
+//            return smsCode;
+////        } catch (Exception e) {
+////            e.printStackTrace();
+////            return ResultUtil.runErr();
+////        }
+//    }
+
+//    @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 +251,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";

--
Gitblit v1.7.1