aboutsummaryrefslogtreecommitdiff
path: root/gn2
diff options
context:
space:
mode:
Diffstat (limited to 'gn2')
-rw-r--r--gn2/wqflask/oauth2/session.py7
-rw-r--r--gn2/wqflask/oauth2/toplevel.py1
2 files changed, 8 insertions, 0 deletions
diff --git a/gn2/wqflask/oauth2/session.py b/gn2/wqflask/oauth2/session.py
index 78c766a8..883a3228 100644
--- a/gn2/wqflask/oauth2/session.py
+++ b/gn2/wqflask/oauth2/session.py
@@ -98,6 +98,7 @@ def set_masquerading(masq_info):
"masquerading": orig_user
})
+
def unset_masquerading():
"""Restore the original session."""
the_session = session_info()
@@ -120,9 +121,15 @@ def is_token_refreshing():
"""Returns whether the token is being refreshed or not."""
return session_info().get("token_refreshing", False)
+
def set_redirect_url(url):
"""Save the current endpoint object"""
return save_session_info({
**session_info(),
"redirect_url": url
})
+
+
+def clear_redirect_url():
+ """Clear the redirect url from Session"""
+ session_info().pop("redirect_url", None)
diff --git a/gn2/wqflask/oauth2/toplevel.py b/gn2/wqflask/oauth2/toplevel.py
index 425c598e..8dd57243 100644
--- a/gn2/wqflask/oauth2/toplevel.py
+++ b/gn2/wqflask/oauth2/toplevel.py
@@ -82,6 +82,7 @@ def authorisation_code():
"logged_in": True
})
redirect_url = session.session_info().get("redirect_url", "/")
+ session.clear_redirect_url()
return redirect(redirect_url)
return no_token_post("auth/token", json=request_data).either(