Przeglądaj źródła

用户修改密码相关

sqg 3 lat temu
rodzic
commit
9beaa1e4a6

+ 5 - 4
tianhu-system/src/main/java/com/tianhu/system/controller/SysUserController.java

@@ -806,10 +806,11 @@ public class SysUserController extends BaseController
     @PutMapping("/resetPwd")
     public AjaxResult resetPwd(@RequestBody SysUser user)
     {
-        String regEx = "^(?![0-9]+$)(?![a-z]+$)(?![A-Z]+$)(?!([^(0-9a-zA-Z)])+$).{6,20}$";
-        Pattern p = Pattern.compile(regEx);
-        Matcher m = p.matcher(user.getPassword());
-        if(m.find()){
+        String checkPassword = "^(?![0-9]+$)(?![a-z]+$)(?![A-Z]+$)(?!([^(0-9a-zA-Z)])+$).{6,20}$";
+        Pattern regePassword = Pattern.compile(checkPassword);
+        Matcher matcherPassword = regePassword.matcher(user.getPassword());
+        boolean isMatPassword = matcherPassword.matches();
+        if (!isMatPassword) {
             return AjaxResult.error("密码请包含数字,英文,字符中的两种以上,长度6-20位");
         }
         userService.checkUserAllowed(user);