完成项目的初始运行

Bug499-WangZiming
王梓铭 2022-11-20 23:23:18 +08:00
parent 671df67723
commit 415ac25a31
2 changed files with 5 additions and 2 deletions

View File

@ -1,4 +1,6 @@
from flask import * from flask import *
from markupsafe import escape
from Login import check_username_availability, verify_user, add_user, get_expiry_date, change_password, WarningMessage from Login import check_username_availability, verify_user, add_user, get_expiry_date, change_password, WarningMessage
@ -20,12 +22,12 @@ def signup():
# POST方法需判断是否注册成功再根据结果返回不同的内容 # POST方法需判断是否注册成功再根据结果返回不同的内容
username = escape(request.form['username']) username = escape(request.form['username'])
password = escape(request.form['password']) password = escape(request.form['password'])
#! 添加如下代码为了过滤注册时的非法字符 #! 添加如下代码为了过滤注册时的非法字符
warn = WarningMessage(username) warn = WarningMessage(username)
if str(warn) != 'OK': if str(warn) != 'OK':
return str(warn) return str(warn)
available = check_username_availability(username) available = check_username_availability(username)
if not available: # 用户名不可用 if not available: # 用户名不可用
flash('用户名 %s 已经被注册。' % (username)) flash('用户名 %s 已经被注册。' % (username))

View File

@ -1,6 +1,7 @@
from datetime import datetime from datetime import datetime
from flask import * from flask import *
from markupsafe import escape
# from app import Yaml # from app import Yaml
# from app.Article import get_today_article, load_freq_history # from app.Article import get_today_article, load_freq_history