Skip to content

Commit

Permalink
fixed redirect url
Browse files Browse the repository at this point in the history
  • Loading branch information
daniyalfarman committed Jan 18, 2024
1 parent 6fadf21 commit eb321ca
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
7 changes: 6 additions & 1 deletion cms/djangoapps/contentstore/views/course.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,9 +631,14 @@ def format_library_for_view(library):
frontend_url = [url for url in settings.CORS_ORIGIN_WHITELIST if 'apps' in url]
if len(frontend_url):
frontent_redirect_url = '{}/panel/settings/billing'.format(frontend_url[0])

try:
destination_course_id = DESTINATION_COURSE_ID_PATTERN.format(org[0])
except Exception:
destination_course_id = "dummy"

return render_to_response(u'index.html', {
u'default_course_id': DESTINATION_COURSE_ID_PATTERN.format(org[0]),
u'default_course_id': destination_course_id,
u'tracking_api_url': tracking_api_url,
u'courses': active_courses,
u'archived_courses': archived_courses,
Expand Down
19 changes: 14 additions & 5 deletions openedx/core/djangoapps/user_authn/views/logout.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
from six.moves.urllib.parse import parse_qs, urlsplit, urlunsplit # pylint: disable=import-error

from lms.envs.common import EDLY_PANEL_ADMIN_USERS_GROUP
from openedx.features.edly.models import EdlyMultiSiteAccess
from openedx.features.edly.utils import get_edly_sub_org_from_request
from openedx.core.djangoapps.user_authn.cookies import delete_logged_in_cookies
from openedx.core.djangoapps.user_authn.utils import is_safe_login_or_logout_redirect
from common.djangoapps.third_party_auth import pipeline as tpa_pipeline
Expand Down Expand Up @@ -76,17 +78,24 @@ def target(self):
require_https=self.request.is_secure(),
)

if use_target_url:
return target_url

if self.is_user_panel_admin:
return settings.PANEL_ADMIN_LOGOUT_REDIRECT_URL

if use_target_url:
return target_url

return self.default_target

def dispatch(self, request, *args, **kwargs):
if request.user.groups.filter(name=EDLY_PANEL_ADMIN_USERS_GROUP):
self.is_user_panel_admin = True
sub_org = get_edly_sub_org_from_request(request)
if request.user.is_authenticated:
edly_multisite_access = EdlyMultiSiteAccess.objects.filter(
sub_org=sub_org,
user=request.user,
groups__name=EDLY_PANEL_ADMIN_USERS_GROUP
)
if edly_multisite_access.exists():
self.is_user_panel_admin = True

# We do not log here, because we have a handler registered to perform logging on successful logouts.
request.is_from_logout = True
Expand Down

0 comments on commit eb321ca

Please sign in to comment.