Compare commits

...

1 Commits

Author SHA1 Message Date
zhwxhhhh 525ccdc238 增加注册条件限制,要求数字,字母和特殊字符 2025-06-05 14:07:50 +08:00
2 changed files with 18 additions and 0 deletions

14
app/static/js/password.js Normal file
View File

@ -0,0 +1,14 @@
function containsDigitsLettersSpecialCharacters(s) {
let resultD = 0, resultL = 0, resultS = 0;
// Digit test
resultD = /\d/.test(s);
// Letter test
resultL = /[a-zA-Z]/.test(s);
// Special character test
resultS = /[!@#$%^&*(),.?":{}|<>]/.test(s);
return resultD + resultL + resultS == 3;
}

View File

@ -24,6 +24,10 @@ You're logged in already! <a href="/logout">Logout</a>.
alert('密码过于简单。(密码长度至少4位)');
return false;
}
if (!containsDigitsLettersSpecialCharacters(password)) {
alert('密码过于简单。(密码要包括数字,字母,特殊符号)');
return false;
}
$.post("/signup", {'username': username, 'password': password},
function (response) {
if (response.status === '0') {