From 06bb8ba7a1bb01e079ce0a2565f6f3e2af3a451f Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 23 Jan 2023 03:38:35 +0300 Subject: oauth2: Retain email input, and "next uri" on error Retain the "next uri" and the email the user had input in the case of an error, so that the user has the chance to correct their input, and still get to the uri they originally intended to (on success). --- wqflask/wqflask/oauth2/routes.py | 4 +++- wqflask/wqflask/templates/oauth2/login.html | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/wqflask/wqflask/oauth2/routes.py b/wqflask/wqflask/oauth2/routes.py index 5411c3c6..2f4d4492 100644 --- a/wqflask/wqflask/oauth2/routes.py +++ b/wqflask/wqflask/oauth2/routes.py @@ -69,7 +69,9 @@ def login(): session["oauth2_token"] = token except OAuthError as _oaerr: flash(_oaerr.args[0], "alert-danger") - return render_template("oauth2/login.html") + return render_template( + "oauth2/login.html", next_endpoint=next_endpoint, + email=form.get("email_address")) if user_logged_in(): if next_endpoint: diff --git a/wqflask/wqflask/templates/oauth2/login.html b/wqflask/wqflask/templates/oauth2/login.html index 6288b630..3de15812 100644 --- a/wqflask/wqflask/templates/oauth2/login.html +++ b/wqflask/wqflask/templates/oauth2/login.html @@ -19,6 +19,7 @@ style="text-align:left;">Email
-- cgit v1.2.3