mirror of https://gitee.com/y_project/RuoYi.git
用户密码新增非法字符验证
parent
4a5ea50a14
commit
f2f6b25ed2
|
@ -5,6 +5,11 @@ $(document).ready(function(){
|
|||
form.submit();
|
||||
}
|
||||
});
|
||||
// 非法字符验证
|
||||
jQuery.validator.addMethod("specialSign",function(value,element) {
|
||||
var char = /^[^<>"'|\\]+$/;
|
||||
return this.optional(element) || (char.test(value));
|
||||
},"不能包含非法字符:< > \" ' \\\ |");
|
||||
// 手机号码验证身份证正则合并:(^\d{15}$)|(^\d{17}([0-9]|X)$)
|
||||
jQuery.validator.addMethod("isPhone",function(value,element) {
|
||||
var length = value.length;
|
||||
|
@ -26,7 +31,6 @@ $(document).ready(function(){
|
|||
var userName = /^[a-zA-Z0-9]{2,13}$/;
|
||||
return this.optional(element) || (userName).test(value);
|
||||
},'请输入数字或者字母,不包含特殊字符');
|
||||
|
||||
// 校验身份证
|
||||
jQuery.validator.addMethod("isIdentity",function(value,element) {
|
||||
var id = /^(\d{15}$|^\d{18}$|^\d{17}(\d|X))$/;
|
||||
|
|
|
@ -8,12 +8,6 @@ $(function() {
|
|||
});
|
||||
});
|
||||
|
||||
$.validator.setDefaults({
|
||||
submitHandler: function() {
|
||||
login();
|
||||
}
|
||||
});
|
||||
|
||||
function login() {
|
||||
var username = $.common.trim($("input[name='username']").val());
|
||||
var password = $.common.trim($("input[name='password']").val());
|
||||
|
@ -66,6 +60,9 @@ function validateRule() {
|
|||
password: {
|
||||
required: icon + "请输入您的密码",
|
||||
}
|
||||
},
|
||||
submitHandler: function(form) {
|
||||
login();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -7,12 +7,6 @@ $(function() {
|
|||
});
|
||||
});
|
||||
|
||||
$.validator.setDefaults({
|
||||
submitHandler: function() {
|
||||
register();
|
||||
}
|
||||
});
|
||||
|
||||
function register() {
|
||||
var username = $.common.trim($("input[name='username']").val());
|
||||
var password = $.common.trim($("input[name='password']").val());
|
||||
|
@ -63,7 +57,8 @@ function validateRule() {
|
|||
},
|
||||
password: {
|
||||
required: true,
|
||||
minlength: 5
|
||||
minlength: 5,
|
||||
specialSign: true
|
||||
},
|
||||
confirmPassword: {
|
||||
required: true,
|
||||
|
@ -83,6 +78,9 @@ function validateRule() {
|
|||
required: icon + "请再次输入您的密码",
|
||||
equalTo: icon + "两次密码输入不一致"
|
||||
}
|
||||
},
|
||||
submitHandler: function(form) {
|
||||
register();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -72,6 +72,7 @@
|
|||
<!-- 全局js -->
|
||||
<script src="../static/js/jquery.min.js" th:src="@{/js/jquery.min.js}"></script>
|
||||
<script src="../static/ajax/libs/validate/jquery.validate.min.js" th:src="@{/ajax/libs/validate/jquery.validate.min.js}"></script>
|
||||
<script src="../static/ajax/libs/validate/jquery.validate.extend.js" th:src="@{/ajax/libs/validate/jquery.validate.extend.js}"></script>
|
||||
<script src="../static/ajax/libs/layer/layer.min.js" th:src="@{/ajax/libs/layer/layer.min.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.8}"></script>
|
||||
|
|
|
@ -168,7 +168,8 @@
|
|||
},
|
||||
password:{
|
||||
minlength: 5,
|
||||
maxlength: 20
|
||||
maxlength: 20,
|
||||
specialSign: true
|
||||
},
|
||||
email:{
|
||||
email:true,
|
||||
|
|
|
@ -260,7 +260,8 @@
|
|||
newPassword: {
|
||||
required: true,
|
||||
minlength: 6,
|
||||
maxlength: 20
|
||||
maxlength: 20,
|
||||
specialSign: true
|
||||
},
|
||||
confirmPassword: {
|
||||
required: true,
|
||||
|
|
|
@ -65,7 +65,8 @@
|
|||
newPassword: {
|
||||
required: true,
|
||||
minlength: 5,
|
||||
maxlength: 20
|
||||
maxlength: 20,
|
||||
specialSign: true
|
||||
},
|
||||
confirmPassword: {
|
||||
required: true,
|
||||
|
|
|
@ -33,7 +33,8 @@
|
|||
password:{
|
||||
required: true,
|
||||
minlength: 5,
|
||||
maxlength: 20
|
||||
maxlength: 20,
|
||||
specialSign: true
|
||||
},
|
||||
},
|
||||
focusCleanup: true
|
||||
|
|
Loading…
Reference in New Issue