diff --git a/app/account_service.py b/app/account_service.py index 09439d5..02394e7 100644 --- a/app/account_service.py +++ b/app/account_service.py @@ -1,4 +1,6 @@ from flask import * +from markupsafe import escape + from Login import check_username_availability, verify_user, add_user, get_expiry_date, change_password, WarningMessage @@ -20,12 +22,12 @@ def signup(): # POST方法需判断是否注册成功,再根据结果返回不同的内容 username = escape(request.form['username']) password = escape(request.form['password']) - + #! 添加如下代码为了过滤注册时的非法字符 warn = WarningMessage(username) if str(warn) != 'OK': return str(warn) - + available = check_username_availability(username) if not available: # 用户名不可用 flash('用户名 %s 已经被注册。' % (username)) diff --git a/app/user_service.py b/app/user_service.py index 79c7888..fbda760 100644 --- a/app/user_service.py +++ b/app/user_service.py @@ -1,6 +1,7 @@ from datetime import datetime from flask import * +from markupsafe import escape # from app import Yaml # from app.Article import get_today_article, load_freq_history