From f44f37ea6f737691f49abbb3ef76731338e3bf76 Mon Sep 17 00:00:00 2001 From: Vladyslav Tymofeiev <“vladyslavty@softwareplanetgroup.com”> Date: Wed, 28 Aug 2024 16:19:03 +0300 Subject: [PATCH] revert last changes --- common/djangoapps/student/helpers.py | 16 +--------------- .../djangoapps/user_authn/views/login_form.py | 8 +++----- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/common/djangoapps/student/helpers.py b/common/djangoapps/student/helpers.py index a2ff280c7aa3..56ab966091ff 100644 --- a/common/djangoapps/student/helpers.py +++ b/common/djangoapps/student/helpers.py @@ -3,7 +3,7 @@ """ -import json +ґimport json import logging import mimetypes import re @@ -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 @@ -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) diff --git a/openedx/core/djangoapps/user_authn/views/login_form.py b/openedx/core/djangoapps/user_authn/views/login_form.py index 05e6d0cebb3d..3292f14da641 100644 --- a/openedx/core/djangoapps/user_authn/views/login_form.py +++ b/openedx/core/djangoapps/user_authn/views/login_form.py @@ -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 @@ -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)