Skip to content

Commit

Permalink
revert last changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladyslav Tymofeiev committed Aug 28, 2024
1 parent 27d9bd4 commit f44f37e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 20 deletions.
16 changes: 1 addition & 15 deletions common/djangoapps/student/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""


import json
ґimport json
import logging
import mimetypes
import re
Expand All @@ -19,7 +19,6 @@
from django.core.exceptions import PermissionDenied
from django.core.validators import ValidationError
from django.db import IntegrityError, transaction
from django.shortcuts import redirect
from django.urls import NoReverseMatch, reverse
from django.utils.translation import ugettext as _
from pytz import UTC
Expand Down Expand Up @@ -740,16 +739,3 @@ def sanitize_next_parameter(next_param):
return sanitized_next_parameter

return next_param


def add_hide_elements_cookie_to_redirect(redirect_to):
if 'hide_elements' in redirect_to:
# Perform the redirect and set the cookie only if 'hide_elements' is present
response = redirect(redirect_to)

# Set a cookie to indicate that elements should be hidden
response.set_cookie('hideElements', 'true', max_age=86400)

return response
else:
return redirect(redirect_to)
8 changes: 3 additions & 5 deletions openedx/core/djangoapps/user_authn/views/login_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
handle_enterprise_cookies_for_logistration,
update_logistration_context_for_enterprise
)
from student.helpers import get_next_url_for_login_page, add_hide_elements_cookie_to_redirect
from student.helpers import get_next_url_for_login_page
from third_party_auth import pipeline
from third_party_auth.decorators import xframe_allow_whitelisted
from util.password_policy_validators import DEFAULT_MAX_PASSWORD_LENGTH
Expand Down Expand Up @@ -146,14 +146,12 @@ def login_and_registration_form(request, initial_mode="login"):
# since Django's SessionAuthentication middleware auto-updates session cookies but not
# the other login-related cookies. See ARCH-282.
if request.user.is_authenticated and are_logged_in_cookies_set(request):
response = add_hide_elements_cookie_to_redirect(redirect_to)
return response
return redirect(redirect_to)

# Tahoe: Disable upstream login/register forms when the Tahoe Identity Provider is enabled.
tahoe_idp_redirect_url = tahoe_idp_helpers.get_idp_form_url(request, initial_mode, redirect_to)
if tahoe_idp_redirect_url:
response = add_hide_elements_cookie_to_redirect(tahoe_idp_redirect_url)
return response
return redirect(tahoe_idp_redirect_url)

# Retrieve the form descriptions from the user API
form_descriptions = _get_form_descriptions(request)
Expand Down

0 comments on commit f44f37e

Please sign in to comment.