From 6ea74adc90abf6e992a59c9d6e6cc2d85de6d2c6 Mon Sep 17 00:00:00 2001 From: Sage Vaillancourt Date: Fri, 23 Sep 2022 18:13:43 +0000 Subject: [PATCH] Redirect to tiny login form on /login GET --- undercover/routes.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/undercover/routes.py b/undercover/routes.py index 7b40925..72654e4 100644 --- a/undercover/routes.py +++ b/undercover/routes.py @@ -63,13 +63,22 @@ class CLForm(Form): ) -@writing_blueprint.route('/login', methods=['POST']) +@writing_blueprint.route('/login', methods=['POST', 'GET']) def login_post(): - username = request.form['username'] - if db.login(username, request.form['password']): - session['username'] = username - return redirect('/') - return make_response("", 401) + if request.method == 'POST': + username = request.form['username'] + if db.login(username, request.form['password']): + session['username'] = username + return redirect('/') + return make_response("", 401) + + return ''' +
+

+

+

+
+ ''' @writing_blueprint.route('/', methods=['GET'])