增加二级等保密码校验

This commit is contained in:
duxp 2024-01-22 11:40:41 +08:00
parent 5220bb806c
commit 9a15c52b4b
5 changed files with 17 additions and 6 deletions

View File

@ -5,6 +5,11 @@ $(document).ready(function(){
form.submit(); 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)$) //手机号码验证身份证正则合并:(^\d{15}$)|(^\d{17}([0-9]|X)$)
jQuery.validator.addMethod("isPhone",function(value,element){ jQuery.validator.addMethod("isPhone",function(value,element){
var length = value.length; var length = value.length;

View File

@ -50,7 +50,8 @@ function validateRule() {
required: true required: true
}, },
password: { password: {
required: true required: true,
isPassword:true
} }
}, },
messages: { messages: {

View File

@ -37,6 +37,7 @@
<h4 class="no-margins" style="font-size: 22px">请登录:业务绩效考核系统</h4> <h4 class="no-margins" style="font-size: 22px">请登录:业务绩效考核系统</h4>
<input class="form-control uname" name="username" placeholder="用户名" type="text" value=""/> <input class="form-control uname" name="username" placeholder="用户名" type="text" value=""/>
<input class="form-control pword" name="password" placeholder="密码" type="password" value=""/> <input class="form-control pword" name="password" placeholder="密码" type="password" value=""/>
<div style="margin-top: 10px">温馨提示密码必须是数字、字母和特殊字符的组合长度至少为8位</div>
<div class="row m-t" th:if="${captchaEnabled==true}"> <div class="row m-t" th:if="${captchaEnabled==true}">
<div class="col-xs-6"> <div class="col-xs-6">
<input class="form-control code" maxlength="5" name="validateCode" placeholder="验证码" <input class="form-control code" maxlength="5" name="validateCode" placeholder="验证码"
@ -66,5 +67,6 @@
<script src="../static/ajax/libs/blockUI/jquery.blockUI.js" th:src="@{/ajax/libs/blockUI/jquery.blockUI.js}"></script> <script src="../static/ajax/libs/blockUI/jquery.blockUI.js" th:src="@{/ajax/libs/blockUI/jquery.blockUI.js}"></script>
<script src="../static/ruoyi/js/ry-ui.js" th:src="@{/ruoyi/js/ry-ui.js?v=4.7.7}"></script> <script src="../static/ruoyi/js/ry-ui.js" th:src="@{/ruoyi/js/ry-ui.js?v=4.7.7}"></script>
<script src="../static/ruoyi/login.js" th:src="@{/ruoyi/login.js}"></script> <script src="../static/ruoyi/login.js" th:src="@{/ruoyi/login.js}"></script>
<script src="../static/ajax/libs/validate/jquery.validate.extend.js" th:src="@{/ajax/libs/validate/jquery.validate.extend.js}"></script>
</body> </body>
</html> </html>

View File

@ -193,7 +193,8 @@
}, },
password:{ password:{
minlength: 5, minlength: 5,
maxlength: 20 maxlength: 20,
isPassword:true,
}, },
email:{ email:{
email:true, email:true,

View File

@ -51,6 +51,7 @@
rules:{ rules:{
oldPassword:{ oldPassword:{
required:true, required:true,
isPassword:true,
remote: { remote: {
url: ctx + "system/user/profile/checkPassword", url: ctx + "system/user/profile/checkPassword",
type: "get", type: "get",
@ -64,6 +65,7 @@
}, },
newPassword: { newPassword: {
required: true, required: true,
isPassword:true,
minlength: 5, minlength: 5,
maxlength: 20 maxlength: 20
}, },