diff --git a/src/main/resources/static/js/resetPwd.js b/src/main/resources/static/js/resetPwd.js index e04c7db..a0f63e8 100644 --- a/src/main/resources/static/js/resetPwd.js +++ b/src/main/resources/static/js/resetPwd.js @@ -25,6 +25,11 @@ function resetUserPwd(){ userList.push(verCode); var tf=checkPwd(); var tfValue=isNull(userList); + var regex = new RegExp('(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])(?=.*[^a-zA-Z0-9]).{8,20}'); + if (!regex.test(pwd)) { + layer.msg("您的密码复杂度太低(密码中必须包含大小字母、数字、特殊字符)!"); + return; + } if(tf){ if(tfValue){ if(random !='' && random==verCode){ diff --git a/src/main/resources/static/js/work/newSub/startWorkApplication.js b/src/main/resources/static/js/work/newSub/startWorkApplication.js index 7f8df68..bda4200 100644 --- a/src/main/resources/static/js/work/newSub/startWorkApplication.js +++ b/src/main/resources/static/js/work/newSub/startWorkApplication.js @@ -50,7 +50,7 @@ $(function () { let num2 = $("#demo3").children().length; num3 = $("#demo2").children().length; if (status == "1"){ - if (num1 > 0){ + if (num1 > 0){ if (num2 > 0){ layer.alert("请先选择需要上传的安全培训材料!") }else { diff --git a/src/main/resources/static/pages/user/changePassword.html b/src/main/resources/static/pages/user/changePassword.html index b4ea218..7c2eece 100644 --- a/src/main/resources/static/pages/user/changePassword.html +++ b/src/main/resources/static/pages/user/changePassword.html @@ -95,10 +95,10 @@ return; } //密码 - let pattern = /^^(?![0-9]+$)(?![0-9\W]+$)(?![0-9A-Z]+$)(?![0-9a-z]+$)(?![a-z\W]+$)(?![A-Z\W]+$)[0-9A-Za-z\W]{8,16}$$/; + var regex = new RegExp('(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])(?=.*[^a-zA-Z0-9]).{8,20}'); let password = $("#newPassword").val(); - if(!pattern.test(password)) { - layer.alert("密码复杂度过低,密码需由大写字母、小写字母、数字、特殊符号,符合三种,8~16位"); + if(!regex.test(password)) { + layer.alert("您的密码复杂度太低(密码中必须包含大小字母、数字、特殊字符)!"); return ; } diff --git a/src/main/resources/static/pages/work/sysMag/changePassword.html b/src/main/resources/static/pages/work/sysMag/changePassword.html index c87fc48..ad5e771 100644 --- a/src/main/resources/static/pages/work/sysMag/changePassword.html +++ b/src/main/resources/static/pages/work/sysMag/changePassword.html @@ -97,7 +97,11 @@ if(!bootstrapValidator.isValid()){ return; } - + var regex = new RegExp('(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])(?=.*[^a-zA-Z0-9]).{8,20}'); + if (!regex.test($("#newPassword").val())) { + layer.msg("您的密码复杂度太低(密码中必须包含大小字母、数字、特殊字符)!"); + return false; + } $.ajax({ type : 'put', url : ctxPath + '/users/'+$("#username").val(),