From 292972c0ce0a9904206d9d99664339f7af9521ee Mon Sep 17 00:00:00 2001 From: Sunflower613 <2963707761@qq.com> Date: Tue, 19 Mar 2024 14:59:36 +0800 Subject: [PATCH] Fix bug 528 --- app/templates/login.html | 5 +++++ app/templates/reset.html | 5 +++++ app/templates/signup.html | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/app/templates/login.html b/app/templates/login.html index b8eb118..169c669 100644 --- a/app/templates/login.html +++ b/app/templates/login.html @@ -15,6 +15,11 @@ alert('输入不能为空!'); return false; } + let reg = /^\S*$/; // 正则表达式,用于匹配不包含空格的字符串 + if (!reg.test(password)) { + alert('输入不能包含空格!'); + return false; + } $.post( "/login", {'username': username, 'password': password}, function (response) { diff --git a/app/templates/reset.html b/app/templates/reset.html index 3425c97..4834695 100644 --- a/app/templates/reset.html +++ b/app/templates/reset.html @@ -12,6 +12,11 @@ alert('输入不能为空!'); return false; } + let reg = /^\S*$/; // 正则表达式,用于匹配不包含空格的字符串 + if (!reg.test(old_password) || !reg.test(new_password)) { + alert('输入不能包含空格!'); + return false; + } if (new_password !== re_new_password) { alert('新密码不匹配,请重新输入'); return false; diff --git a/app/templates/signup.html b/app/templates/signup.html index 5b3aafe..8d688f3 100644 --- a/app/templates/signup.html +++ b/app/templates/signup.html @@ -16,6 +16,11 @@ You're logged in already! Logout. alert('输入不能为空!'); return false; } + let reg = /^\S*$/; // 正则表达式,用于匹配不包含空格的字符串 + if (!reg.test(password) || !reg.test(password2)) { + alert('输入不能包含空格!'); + return false; + } if (password !== password2) { alert('确认密码与输入密码不一致!'); return false;