Make sure password and re-entered password are the same during sign-up.
parent
4a2770eb2f
commit
7d2266131d
|
@ -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)
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
Flask==2.1.0
|
||||
Flask==1.1.2
|
||||
selenium==3.141.0
|
||||
PyYAML~=6.0
|
||||
|
|
Loading…
Reference in New Issue