diff --git a/app.py b/app.py index 585e89e..f68f010 100644 --- a/app.py +++ b/app.py @@ -9,6 +9,18 @@ from datetime import datetime from dateutil.tz import tzlocal import html2text from config import C +WRONG_ANS_HTML = ''' + + + +错误 + + +

验证问题回答错误

+回退 + + +''' app = Flask(__name__) app.config.from_object('config.C') @@ -99,18 +111,7 @@ def new_one(): for name, ques, hint, ans in C.verify: if request.form.get(name) != ans: - return ''' - - - - 错误 - - -

验证问题回答错误

- 回退 - - - ''', 401 + return WRONG_ANS_HTML, 401 if not content or len(content)>4000: abort(422) if private and len(private)>1000: abort(422) @@ -134,6 +135,18 @@ def new_one(): return redirect(".") +@app.route('/ordinary/judge', methods=['POST']) +@limiter.limit("10 / hour; 1 / 2 second") +def judge(): + + group = request.form.get('groupType') + + for name, ques, hint, ans in C.verify: + if request.form.get(name) != ans: + return WRONG_ANS_HTML, 401 + + return redirect(C.groups.get(group)) + @limiter.limit("100 / hour; 2 / second") @app.route('/ordinary//comments') def get_comments(toot): diff --git a/templates/list.html b/templates/list.html index 049d750..4f5c375 100644 --- a/templates/list.html +++ b/templates/list.html @@ -258,15 +258,15 @@
- +
- +
- +
@@ -279,7 +279,7 @@ {% endfor %} -

(火热开发中... 马上就可以点了)

+