From 972a1a5524dde8fcdea9ad3b63f7e397ebba504a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E7=A7=8B=E4=BC=9F?= <2658626578@qq.com> Date: Sun, 29 Jan 2023 11:49:27 +0800 Subject: [PATCH] Bug490-ChenQiuwei (#63) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复Bug-490,使注册时确认密码能够发挥作用,在确认密码与所设置密码不一致时,能够提示“确认密码与输入密码不一致”。 Co-authored-by: 2658626578 <2658626578@qq.com> Co-authored-by: Hui Lan Reviewed-on: http://121.4.94.30:3000/mrlan/EnglishPal/pulls/63 Co-authored-by: 陈秋伟 <2658626578@qq.com> Co-committed-by: 陈秋伟 <2658626578@qq.com> --- app/account_service.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/account_service.py b/app/account_service.py index dc854a3..9b1c46b 100644 --- a/app/account_service.py +++ b/app/account_service.py @@ -5,7 +5,6 @@ from Login import check_username_availability, verify_user, add_user, get_expiry # 初始化蓝图 accountService = Blueprint("accountService", __name__) - ### Sign-up, login, logout ### @accountService.route("/signup", methods=['GET', 'POST']) def signup(): @@ -20,6 +19,7 @@ def signup(): # POST方法需判断是否注册成功,再根据结果返回不同的内容 username = escape(request.form['username']) password = escape(request.form['password']) + password2 = escape(request.form['password2']) #! 添加如下代码为了过滤注册时的非法字符 warn = WarningMessage(username) @@ -32,6 +32,8 @@ def signup(): return render_template('signup.html') elif len(password.strip()) < 4: # 密码过短 return '密码过于简单。' + elif password != password2: + return '确认密码与输入密码不一致!' else: # 添加账户信息 add_user(username, password) verified = verify_user(username, password) @@ -48,6 +50,7 @@ def signup(): return '用户名密码验证失败。' + @accountService.route("/login", methods=['GET', 'POST']) def login(): '''