Add setting for HTTPS in email links

This commit is contained in:
Andrea M 2019-07-04 10:32:49 +02:00
parent 0de263280f
commit c969577161
2 changed files with 14 additions and 2 deletions

View File

@ -666,7 +666,12 @@ class Ticket(models.Model):
site = Site.objects.get_current()
except ImproperlyConfigured:
site = Site(domain='configure-django-sites.com')
return u"http://%s%s?ticket=%s&email=%s&key=%s" % (
if settings.HELPDESK_USE_HTTPS_IN_EMAIL_LINK:
protocol = 'https'
else:
protocol = 'http'
return u"%s://%s%s?ticket=%s&email=%s&key=%s" % (
protocol,
site.domain,
reverse('helpdesk:public_view'),
self.ticket_for_url,
@ -687,7 +692,12 @@ class Ticket(models.Model):
site = Site.objects.get_current()
except ImproperlyConfigured:
site = Site(domain='configure-django-sites.com')
return u"http://%s%s" % (
if settings.HELPDESK_USE_HTTPS_IN_EMAIL_LINK:
protocol = 'https'
else:
protocol = 'http'
return u"%s://%s%s" % (
protocol,
site.domain,
reverse('helpdesk:view',
args=[self.id])

View File

@ -149,6 +149,8 @@ QUEUE_EMAIL_BOX_UPDATE_ONLY = getattr(settings, 'QUEUE_EMAIL_BOX_UPDATE_ONLY', F
HELPDESK_ENABLE_PER_QUEUE_STAFF_PERMISSION = getattr(
settings, 'HELPDESK_ENABLE_PER_QUEUE_STAFF_PERMISSION', False)
# use https in the email links
HELPDESK_USE_HTTPS_IN_EMAIL_LINK = getattr(settings, 'HELPDESK_USE_HTTPS_IN_EMAIL_LINK', False)
# Asynchronous Datatables - Optional
HELPDESK_USE_SERVERSIDE_PROCESSING = getattr(