aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-01-23 03:38:35 +0300
committerFrederick Muriuki Muriithi2023-01-23 03:38:35 +0300
commit06bb8ba7a1bb01e079ce0a2565f6f3e2af3a451f (patch)
tree8fac09b7d16a798e135df82916cd3f10c527a808
parent84e8138c6111d7ddf3928c52200342180db2b205 (diff)
downloadgenenetwork2-06bb8ba7a1bb01e079ce0a2565f6f3e2af3a451f.tar.gz
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).
-rw-r--r--wqflask/wqflask/oauth2/routes.py4
-rw-r--r--wqflask/wqflask/templates/oauth2/login.html1
2 files changed, 4 insertions, 1 deletions
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</label>
<div style="margin-left:20px;" class="col-xs-4">
<input id="email_address" name="email_address" type="email"
+ {%if email%}value="{{email}}"{%endif%}
placeholder="your@email.address" size="50"
class="form-control" />
</div>