Compare commits

...

2 Commits

Author SHA1 Message Date
mrlan 92331ca7a0 Merge pull request 'Fix bug 478' (#184) from Bug478-Hui into Alpha-snapshot20240618
Reviewed-on: #184
2024-09-05 10:12:21 +08:00
Lan Hui 1166d3499f Fix bug 478 2024-09-05 10:11:20 +08:00
1 changed files with 25 additions and 0 deletions

View File

@ -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('没有滑动验证');