From 9a15c52b4b079fafe08262055b68388518211a88 Mon Sep 17 00:00:00 2001 From: duxp Date: Mon, 22 Jan 2024 11:40:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=8C=E7=BA=A7=E7=AD=89?= =?UTF-8?q?=E4=BF=9D=E5=AF=86=E7=A0=81=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../static/ajax/libs/validate/jquery.validate.extend.js | 7 ++++++- cyx-admin/src/main/resources/static/ruoyi/login.js | 9 +++++---- cyx-admin/src/main/resources/templates/login.html | 2 ++ .../src/main/resources/templates/system/user/add.html | 3 ++- .../templates/system/user/profile/resetPwd.html | 2 ++ 5 files changed, 17 insertions(+), 6 deletions(-) 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 },