用户密码支持自定义配置规则
This commit is contained in:
@ -347,6 +347,32 @@ function calSumWidth(elements) {
|
||||
return width;
|
||||
}
|
||||
|
||||
/** 密码规则范围验证 */
|
||||
function checkpwd(chrtype, password) {
|
||||
if (chrtype == 1) {
|
||||
if(!$.common.numValid(password)){
|
||||
$.modal.alertWarning("密码只能为0-9数字");
|
||||
return false;
|
||||
}
|
||||
} else if (chrtype == 2) {
|
||||
if(!$.common.enValid(password)){
|
||||
$.modal.alertWarning("密码只能为a-z和A-Z字母");
|
||||
return false;
|
||||
}
|
||||
} else if (chrtype == 3) {
|
||||
if(!$.common.enNumValid(password)){
|
||||
$.modal.alertWarning("密码必须包含字母以及数字");
|
||||
return false;
|
||||
}
|
||||
} else if (chrtype == 4) {
|
||||
if(!$.common.charValid(password)){
|
||||
$.modal.alertWarning("密码必须包含字母、数字、以及特殊符号-、_");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// 日志打印封装处理
|
||||
var log = {
|
||||
log: function(msg) {
|
||||
|
@ -1582,6 +1582,26 @@ var table = {
|
||||
isMobile: function () {
|
||||
return navigator.userAgent.match(/(Android|iPhone|SymbianOS|Windows Phone|iPad|iPod)/i);
|
||||
},
|
||||
// 数字正则表达式,只能为0-9数字
|
||||
numValid : function(text){
|
||||
var patten = new RegExp(/^[0-9]+$/);
|
||||
return patten.test(text);
|
||||
},
|
||||
// 英文正则表达式,只能为a-z和A-Z字母
|
||||
enValid : function(text){
|
||||
var patten = new RegExp(/^[a-zA-Z]+$/);
|
||||
return patten.test(text);
|
||||
},
|
||||
// 英文、数字正则表达式,必须包含(字母,数字)
|
||||
enNumValid : function(text){
|
||||
var patten = new RegExp(/^(?=.*[a-zA-Z]+)(?=.*[0-9]+)[a-zA-Z0-9]+$/);
|
||||
return patten.test(text);
|
||||
},
|
||||
// 英文、数字、特殊字符正则表达式,必须包含(字母,数字,特殊字符-_)
|
||||
charValid : function(text){
|
||||
var patten = new RegExp(/^(?=.*[A-Za-z])(?=.*\d)(?=.*[-_])[A-Za-z\d-_]{6,}$/);
|
||||
return patten.test(text);
|
||||
},
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
||||
|
Reference in New Issue
Block a user