diff --git a/cyx-admin/src/main/resources/static/ajax/libs/validate/jquery.validate.extend.js b/cyx-admin/src/main/resources/static/ajax/libs/validate/jquery.validate.extend.js index ace52c0..e7811c4 100644 --- a/cyx-admin/src/main/resources/static/ajax/libs/validate/jquery.validate.extend.js +++ b/cyx-admin/src/main/resources/static/ajax/libs/validate/jquery.validate.extend.js @@ -4,7 +4,12 @@ $(document).ready(function(){ submitHandler: function(form) { form.submit(); } - }); + }); + //密码校验 密码必须是数字、字母和特殊字符的组合,长度至少为8位 + jQuery.validator.addMethod("isPassword", function (value, element) { + var isPassword = /^(?=.*[a-z])(?=.*\d)(?=.*[@$!%*#?&]){8,}/; + return this.optional(element) || (isPassword.test(value)); + }, "密码必须是数字、字母和特殊字符的组合,长度至少为8位"); //手机号码验证身份证正则合并:(^\d{15}$)|(^\d{17}([0-9]|X)$) jQuery.validator.addMethod("isPhone",function(value,element){ var length = value.length; diff --git a/cyx-admin/src/main/resources/static/ruoyi/login.js b/cyx-admin/src/main/resources/static/ruoyi/login.js index 1191188..30a9bcf 100644 --- a/cyx-admin/src/main/resources/static/ruoyi/login.js +++ b/cyx-admin/src/main/resources/static/ruoyi/login.js @@ -33,9 +33,9 @@ function login() { if (r.code == web_status.SUCCESS) { location.href = ctx + 'index'; } else { - $('.imgcode').click(); - $(".code").val(""); - $.modal.msg(r.msg); + $('.imgcode').click(); + $(".code").val(""); + $.modal.msg(r.msg); } $.modal.closeLoading(); } @@ -50,7 +50,8 @@ function validateRule() { required: true }, password: { - required: true + required: true, + isPassword:true } }, messages: { diff --git a/cyx-admin/src/main/resources/templates/login.html b/cyx-admin/src/main/resources/templates/login.html index b2cb998..37ed543 100644 --- a/cyx-admin/src/main/resources/templates/login.html +++ b/cyx-admin/src/main/resources/templates/login.html @@ -37,6 +37,7 @@

请登录:业务绩效考核系统

+
温馨提示:密码必须是数字、字母和特殊字符的组合,长度至少为8位!
+ diff --git a/cyx-admin/src/main/resources/templates/system/user/add.html b/cyx-admin/src/main/resources/templates/system/user/add.html index 7fe811d..1ba4752 100644 --- a/cyx-admin/src/main/resources/templates/system/user/add.html +++ b/cyx-admin/src/main/resources/templates/system/user/add.html @@ -193,7 +193,8 @@ }, password:{ minlength: 5, - maxlength: 20 + maxlength: 20, + isPassword:true, }, email:{ email:true, diff --git a/cyx-admin/src/main/resources/templates/system/user/profile/resetPwd.html b/cyx-admin/src/main/resources/templates/system/user/profile/resetPwd.html index 92f621d..b1fa0cd 100644 --- a/cyx-admin/src/main/resources/templates/system/user/profile/resetPwd.html +++ b/cyx-admin/src/main/resources/templates/system/user/profile/resetPwd.html @@ -51,6 +51,7 @@ rules:{ oldPassword:{ required:true, + isPassword:true, remote: { url: ctx + "system/user/profile/checkPassword", type: "get", @@ -64,6 +65,7 @@ }, newPassword: { required: true, + isPassword:true, minlength: 5, maxlength: 20 },