aboutsummaryrefslogtreecommitdiff
path: root/gn2/wqflask/oauth2
diff options
context:
space:
mode:
authorAlexander_Kabui2024-09-17 17:50:16 +0300
committerAlexander_Kabui2024-09-17 17:50:16 +0300
commite2bcefce9a3f77a86542cb41d53a82ce2dcdc2ad (patch)
treed8285a9e9c7c370959a97fecadd40412e37c1b65 /gn2/wqflask/oauth2
parent02b2ac384953f2d69479a1ea53a071043394b590 (diff)
downloadgenenetwork2-e2bcefce9a3f77a86542cb41d53a82ce2dcdc2ad.tar.gz
Redirect users to login page if they attempt to access a service that requires authentication but are not logged in
Diffstat (limited to 'gn2/wqflask/oauth2')
-rw-r--r--gn2/wqflask/oauth2/checks.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/gn2/wqflask/oauth2/checks.py b/gn2/wqflask/oauth2/checks.py
index 4a5a117f..944760ad 100644
--- a/gn2/wqflask/oauth2/checks.py
+++ b/gn2/wqflask/oauth2/checks.py
@@ -12,6 +12,7 @@ from .client import (
authserver_uri,
oauth2_clientid,
oauth2_clientsecret)
+from .request_utils import authserver_authorise_uri
def require_oauth2(func):
@@ -22,8 +23,8 @@ def require_oauth2(func):
def __clear_session__(_no_token):
session.clear_session_info()
- flash("You need to be logged in.", "alert-warning")
- return redirect("/")
+ # redirect to the login page
+ return redirect(authserver_authorise_uri())
def __with_token__(token):
resp = oauth2_client().get(