Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Use conditionally https in e-mail templates

Anna Siwik6f6344907085
diff --git a/saleor/dashboard/emails.py b/saleor/dashboard/emails.py
index 1ffd31bea0..266c7f6a72 100644
--- a/saleor/dashboard/emails.py
+++ b/saleor/dashboard/emails.py
@@ -14,7 +14,7 @@ from ..core.utils import build_absolute_uri
def send_set_password_email(staff):
site = Site.objects.get_current()
ctx = {
- 'protocol': 'http',
+ 'protocol': 'https' if settings.ENABLE_SSL else 'http',
'domain': site.domain,
'site_name': site.name,
'uid': urlsafe_base64_encode(force_bytes(staff.pk)).decode(),
@@ -30,7 +30,7 @@ def send_set_password_email(staff):
def send_promote_customer_to_staff_email(staff):
site = Site.objects.get_current()
ctx = {
- 'protocol': 'http',
+ 'protocol': 'https' if settings.ENABLE_SSL else 'http',
'domain': site.domain,
'url': build_absolute_uri(reverse('dashboard:index')),
'site_name': site.name}
diff --git a/saleor/order/emails.py b/saleor/order/emails.py
index 2ea6a99524..dd5404a52c 100644
--- a/saleor/order/emails.py
+++ b/saleor/order/emails.py
@@ -11,7 +11,7 @@ CONFIRM_NOTE_TEMPLATE = 'order/note/confirm_note'
def _send_confirmation(email, url, template, context=None):
site = Site.objects.get_current()
ctx = {
- 'protocol': 'http',
+ 'protocol': 'https' if settings.ENABLE_SSL else 'http',
'site_name': site.name,
'domain': site.domain,
'url': url}