From 415ac25a311fb5222afa26e886cb13c5be49ab89 Mon Sep 17 00:00:00 2001 From: torch <178428409@qq.com> Date: Sun, 20 Nov 2022 23:23:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E9=A1=B9=E7=9B=AE=E7=9A=84?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E8=BF=90=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/account_service.py | 6 ++++-- app/user_service.py | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) 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