Skip to content

Commit

Permalink
logged in path fixed to by pass (#337)
Browse files Browse the repository at this point in the history
  • Loading branch information
marslanabdulrauf authored Nov 18, 2022
1 parent b1e2b00 commit 4a693b8
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions openedx/features/edly/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def process_request(self, request):
if request.user.is_superuser or request.user.is_staff:
return

if get_current_plan_from_site_configurations() == TRIAL_EXPIRED and not _is_logged_in_path(request.path):
if get_current_plan_from_site_configurations() == TRIAL_EXPIRED and not _is_internal_path(request.path):
redirect_url = getattr(settings, 'EXPIRE_REDIRECT_URL', None)
return HttpResponseRedirect(redirect_url)

Expand Down Expand Up @@ -103,17 +103,13 @@ def _should_update_config(current_value, new_value):
return isinstance(current_value, dict) and isinstance(new_value, dict)


def _is_logged_in_path(path):
def _is_internal_path(path):
"""
Check if the given path is for login.
Check if the given path is for internal use.
"""
login_paths = ['/login', '/oauth2/']
login_paths = ['login', 'oauth2', 'logout', 'api', 'media', ]
for login_path in login_paths:
if login_path in path:
return True

# Exception for media paths
if '/media' in path:
return True

return False

0 comments on commit 4a693b8

Please sign in to comment.