Commit b42f89ad74d0e12968cd969dbeb5cf87b4347a6b

Authored by lizhuojun
1 parent 839129bb

增加密码复杂度验证

src/main/resources/static/index.html
... ... @@ -632,6 +632,6 @@
632 632 data-exclude=1></script>
633 633  
634 634 <script src="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.jquery.js" merge="plugins"></script>
635   -
  635 +<script src="/metronic_v4.5.4/plugins/jquery-validation/js/additional-methods.js"></script>
636 636 </body>
637 637 </html>
638 638 \ No newline at end of file
... ...
src/main/resources/static/metronic_v4.5.4/plugins/jquery-validation/js/additional-methods.js
... ... @@ -36,7 +36,13 @@
36 36 regex = /\b\w+\b/g;
37 37 return this.optional(element) || valueStripped.match(regex).length >= params[0] && valueStripped.match(regex).length <= params[1];
38 38 }, $.validator.format("Please enter between {0} and {1} words."));
39   -
  39 + $.validator.addMethod("passwordRule", function(value, element, param) {
  40 + var length = value.length;
  41 + var letter=/^.*[a-zA-Z]+.*$/;
  42 + var num=/^.*[0-9]+.*$/;
  43 + var symbol=/^.*([^a-zA-Z0-9])+.*$/;
  44 + return length>10&& letter.test(value)&& num.test(value)&&symbol.test(value);
  45 + }, $.validator.format("请确保输入的值包含字母、数字、特殊符号"));
40 46 }());
41 47  
42 48 // Accept a value from a file input based on a required mimetype
... ...
src/main/resources/static/metronic_v4.5.4/plugins/jquery-validation/js/localization/messages_zh.js
... ... @@ -20,6 +20,7 @@ $.extend($.validator.messages, {
20 20 number: "请输入有效的数字",
21 21 digits: "只能输入数字",
22 22 creditcard: "请输入有效的信用卡号码",
  23 + passwordRule: "请确保输入的值包含字母、数字、特殊符号",
23 24 equalTo: "你的输入不相同",
24 25 extension: "请输入有效的后缀",
25 26 maxlength: $.validator.format("最多可以输入 {0} 个字符"),
... ...
src/main/resources/static/pages/permission/user/add.html
... ... @@ -119,8 +119,9 @@
119 119 },
120 120 'password' : {
121 121 required : true,
122   - minlength: 6,
123   - maxlength: 25
  122 + minlength: 10,
  123 + maxlength: 25,
  124 + passwordRule:true
124 125 },
125 126 'cfmPassword' : {
126 127 equalTo: '#password'
... ...