瀏覽代碼

fix 讲义列表

he2802 2 年之前
父節點
當前提交
76e329eec9

+ 21 - 0
zhongzheng-common/src/main/java/com/zhongzheng/common/utils/ToolsUtils.java

@@ -1,5 +1,6 @@
 package com.zhongzheng.common.utils;
 
+import cn.hutool.core.lang.Validator;
 import com.aliyun.dysmsapi20170525.models.SendSmsRequest;
 import com.aliyun.dysmsapi20170525.models.SendSmsResponse;
 import com.aliyun.teaopenapi.models.Config;
@@ -11,6 +12,8 @@ import java.nio.charset.StandardCharsets;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
 import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipOutputStream;
 
@@ -315,4 +318,22 @@ public class ToolsUtils {
         return result;
     }
 
+    public static boolean verifPwd(String passWord) {
+        if(Validator.isEmpty(passWord)){
+            return false;
+        }
+        if(passWord.length()<6||passWord.length()>18){
+            return false;
+        }
+       /* String regExp = "^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\\W_!@#$%^&*`~()-+=]+$)(?![a-z0-9]+$)(?![a-z\\W_!@#$%^&*`~()-+=]+$)(?![0-9\\W_!@#$%^&*`~()-+=]+$)(?![a-zA-Z0-9]+$)(?![a-zA-Z\\W_!@#$%^&*`~()-+=]+$)(?![a-z0-9\\W_!@#$%^&*`~()-+=]+$)(?![0-9A-Z\\W_!@#$%^&*`~()-+=]+$)[a-zA-Z0-9\\W_!@#$%^&*`~()-+=]{6,16}$";
+        Pattern p = Pattern.compile(regExp);
+        Matcher m = p.matcher(passWord);
+        if (m.matches()){
+            return true;
+        } else {
+            return false;
+        }*/
+        return true;
+    }
+
 }

+ 3 - 0
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/UserServiceImpl.java

@@ -690,6 +690,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
         if(bo.getPwd()==null){
             throw new CustomException("密码不能为空");
         }
+        if(!ToolsUtils.verifPwd(bo.getPwd())){
+            throw new CustomException("密码长度为6-18个字符");
+        }
         String key = Constants.REGISTER_SMS + bo.getTel();
         String code =  redisCache.getCacheObject(key);
         if(code==null){