Fix bug 478
parent
fe1d4c29ff
commit
1166d3499f
|
@ -21,6 +21,27 @@
|
|||
slider.init(); // 初始化滑块解锁功能
|
||||
});
|
||||
|
||||
function containsDigitsLettersSpecialCharacters(s) {
|
||||
let resultD = 0, resultL = 0, resultS = 0;
|
||||
|
||||
// Digit test
|
||||
'0123456789'.split('').forEach((x) => {
|
||||
if (s.includes(x))
|
||||
resultD = 1;
|
||||
});
|
||||
|
||||
// Letter test
|
||||
resultL = /[a-z]/i.test(s);
|
||||
|
||||
// Special charater test
|
||||
'+-*/,.:;/\[]<>$%&()!?^~'.split('').forEach((x) => {
|
||||
if (s.includes(x))
|
||||
resultS = 1;
|
||||
});
|
||||
|
||||
return resultD + resultL + resultS == 3;
|
||||
}
|
||||
|
||||
function signup(){
|
||||
// 发起 AJAX 请求来处理注册
|
||||
username = $("#username").val().trim();
|
||||
|
@ -44,6 +65,10 @@
|
|||
alert('密码过于简单。(密码长度至少4位)');
|
||||
return false;
|
||||
}
|
||||
if (!containsDigitsLettersSpecialCharacters(password)) {
|
||||
alert('密码过于简单。(密码要包括数字,字母,特殊符号)');
|
||||
return false;
|
||||
}
|
||||
is_ok = slider.getIsOk();
|
||||
if(!is_ok){
|
||||
alert('没有滑动验证');
|
||||
|
|
Loading…
Reference in New Issue