From 7d2266131d0a63c4ee3949c59c25f97cac0830f6 Mon Sep 17 00:00:00 2001 From: Hui Lan Date: Sun, 29 Jan 2023 11:45:27 +0800 Subject: [PATCH] Make sure password and re-entered password are the same during sign-up. --- app/account_service.py | 8 +------- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/app/account_service.py b/app/account_service.py index 1717889..e572bd0 100644 --- a/app/account_service.py +++ b/app/account_service.py @@ -5,11 +5,6 @@ from Login import check_username_availability, verify_user, add_user, get_expiry # 初始化蓝图 accountService = Blueprint("accountService", __name__) -# 确认密码和输入密码是否一致 -def verify_passverified(password,password2): - if(password==password2): - return True - ### Sign-up, login, logout ### @accountService.route("/signup", methods=['GET', 'POST']) def signup(): @@ -33,13 +28,12 @@ def signup(): available = check_username_availability(username) - verified_2 = verify_passverified(password, password2) # 比较“密码”与“确认密码” if not available: # 用户名不可用 flash('用户名 %s 已经被注册。' % (username)) return render_template('signup.html') elif len(password.strip()) < 4: # 密码过短 return '密码过于简单。' - elif not verified_2: + elif password != password2: return '确认密码与输入密码不一致!' else: # 添加账户信息 add_user(username, password) diff --git a/requirements.txt b/requirements.txt index 8552794..2746a3b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ -Flask==2.1.0 +Flask==1.1.2 selenium==3.141.0 PyYAML~=6.0