From 89a237bec1ddb0ffb7d36a7648a7827fc8c6eddb Mon Sep 17 00:00:00 2001 From: Muhammad Adeel Tajamul <77053848+muhammadadeeltajamul@users.noreply.github.com> Date: Thu, 4 Jul 2024 16:29:22 +0500 Subject: [PATCH] fix: added https protocol in email unsubscribe url (#35087) --- openedx/core/djangoapps/notifications/email/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/openedx/core/djangoapps/notifications/email/utils.py b/openedx/core/djangoapps/notifications/email/utils.py index 5fb07fc34817..3ce2306435f2 100644 --- a/openedx/core/djangoapps/notifications/email/utils.py +++ b/openedx/core/djangoapps/notifications/email/utils.py @@ -76,7 +76,10 @@ def get_unsubscribe_link(username, patch): 'patch': encrypted_patch } relative_url = reverse('preference_update_from_encrypted_username_view', kwargs=kwargs) - return f"{settings.LMS_BASE}{relative_url}" + protocol = 'https://' + if settings.DEBUG: + protocol = 'http://' + return f"{protocol}{settings.LMS_BASE}{relative_url}" def create_email_template_context(username):