Forráskód Böngészése

伊宁项目更改相关 统一app相关 变更用户密码校验规则

1037015548@qq.com 1 éve
szülő
commit
df7fb16bc7

+ 13 - 7
ruoyi-admin/src/main/resources/templates/system/user/profile/resetPwd.html

@@ -23,7 +23,7 @@
                 <label class="col-sm-3 control-label">新密码:</label>
                 <div class="col-sm-8">
                     <input class="form-control" type="password" name="newPassword" id="newPassword">
-                    <th:block th:with="chrtype=${@config.getKey('sys.account.chrtype')}"> 
+                    <th:block th:with="chrtype=4">
                         <th:block th:if="${chrtype != '0'}">
                             <span class="help-block m-b-none">
                                 <th:block th:if="${chrtype == '1'}"><i class="fa fa-info-circle" style="color: red;"></i>  密码只能为0-9数字 </th:block>
@@ -45,8 +45,16 @@
         </form>
     </div>
     <th:block th:include="include :: footer" />
-
     <script>
+        $.validator.addMethod("pwdMatch",function(value,element,params){
+            //强密码正则表达式-大小写字母、数字、符号三种类型组合的密码,长度至少为8位
+            var strongRegex = new RegExp("^(?=.{8,})(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*\\W).*$", "g");
+            if(strongRegex.test(value)) {
+                return true;
+            }else {
+                return false;
+            }
+        },"请使用大小写字母、数字、符号三种类型组合的密码,长度至少为8位。");
         $("#form-user-resetPwd").validate({
             rules:{
                 oldPassword:{
@@ -63,9 +71,7 @@
                     }
                 },
                 newPassword: {
-                    required: true,
-                    minlength: 5,
-                    maxlength: 20
+                    pwdMatch:[]
                 },
                 confirmPassword: {
                     required: true,
@@ -88,9 +94,9 @@
                 }
 
             },
-            focusCleanup: true
+            focusCleanup: true,
         });
-        
+
         function submitHandler() {
             var chrtype = [[${#strings.defaultString(@config.getKey('sys.account.chrtype'), 0)}]];
             var password = $("#newPassword").val();