From e2bcefce9a3f77a86542cb41d53a82ce2dcdc2ad Mon Sep 17 00:00:00 2001 From: Alexander_Kabui Date: Tue, 17 Sep 2024 17:50:16 +0300 Subject: Redirect users to login page if they attempt to access a service that requires authentication but are not logged in --- gn2/wqflask/oauth2/checks.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'gn2/wqflask') 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( -- cgit v1.2.3