diff options
author | Alexander Kabui | 2024-09-24 10:27:12 +0300 |
---|---|---|
committer | GitHub | 2024-09-24 10:27:12 +0300 |
commit | d88092a53ab9498b45149318a2850703b9ead456 (patch) | |
tree | 4cb9b1a79105e98f8a7adfdf92c71d886c50c642 /gn2/wqflask | |
parent | 66cd75d1a0be493c1740fe245c9d58f1a5dd3409 (diff) | |
parent | 105caf070ad3c46d51f8f375ad74115515372f05 (diff) | |
download | genenetwork2-d88092a53ab9498b45149318a2850703b9ead456.tar.gz |
Merge pull request #878 from genenetwork/chores/redirect-after-login-fixes
Minor fixes for redirect_url in session
Diffstat (limited to 'gn2/wqflask')
-rw-r--r-- | gn2/wqflask/oauth2/session.py | 7 | ||||
-rw-r--r-- | gn2/wqflask/oauth2/toplevel.py | 1 |
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( |