aboutsummaryrefslogtreecommitdiff
path: root/gn2
diff options
context:
space:
mode:
authorAlexander_Kabui2024-09-23 12:55:09 +0300
committerAlexander_Kabui2024-09-23 12:55:09 +0300
commit105caf070ad3c46d51f8f375ad74115515372f05 (patch)
tree4cb9b1a79105e98f8a7adfdf92c71d886c50c642 /gn2
parent66cd75d1a0be493c1740fe245c9d58f1a5dd3409 (diff)
downloadgenenetwork2-105caf070ad3c46d51f8f375ad74115515372f05.tar.gz
Add method to clear redirect url from session.
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(