From 39ee98420ae7da748611a42f578d109320812c23 Mon Sep 17 00:00:00 2001 From: Shafqat Farhan Date: Wed, 15 Sep 2021 13:56:53 +0500 Subject: [PATCH] fix: VAN-474 - Deleted cookie for activation popup --- common/djangoapps/student/views/management.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/common/djangoapps/student/views/management.py b/common/djangoapps/student/views/management.py index 70232383ff..f3a2d6367e 100644 --- a/common/djangoapps/student/views/management.py +++ b/common/djangoapps/student/views/management.py @@ -527,6 +527,7 @@ def activate_account(request, key): html_end=HTML('

'), ) + show_account_activation_popup = None try: registration = Registration.objects.get(activation_key=key) except (Registration.DoesNotExist, Registration.MultipleObjectsReturned): @@ -585,6 +586,7 @@ def activate_account(request, key): ), extra_tags='account-activation aa-icon', ) + show_account_activation_popup = request.COOKIES.get(settings.SHOW_ACTIVATE_CTA_POPUP_COOKIE_NAME, None) # If a safe `next` parameter is provided in the request # and it's not the same as the dashboard, redirect there. @@ -612,7 +614,14 @@ def activate_account(request, key): url_path = '/login?{}'.format(urllib.parse.urlencode(params)) return redirect(settings.AUTHN_MICROFRONTEND_URL + url_path) - return redirect(redirect_url) if redirect_url and is_enterprise_learner(request.user) else redirect('dashboard') + response = redirect(redirect_url) if redirect_url and is_enterprise_learner(request.user) else redirect('dashboard') + if show_account_activation_popup: + response.delete_cookie( + settings.SHOW_ACTIVATE_CTA_POPUP_COOKIE_NAME, + domain=settings.SESSION_COOKIE_DOMAIN, + path='/', + ) + return response @ensure_csrf_cookie