aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--servo/forms/admin.py11
-rw-r--r--servo/models/device.py4
-rw-r--r--servo/models/note.py16
-rw-r--r--servo/templates/admin/settings.html2
4 files changed, 25 insertions, 8 deletions
diff --git a/servo/forms/admin.py b/servo/forms/admin.py
index 0fa0058..f1e610d 100644
--- a/servo/forms/admin.py
+++ b/servo/forms/admin.py
@@ -474,7 +474,16 @@ class SettingsForm(BaseForm):
label=_('Password'),
widget=forms.PasswordInput()
)
- smtp_ssl = forms.BooleanField(initial=True, required=False, label=_('Use SSL'))
+
+ ENCRYPTION_CHOICES = (
+ ('OFF', _('None')),
+ ('SSL', 'SSL'),
+ ('TLS', 'TLS'),
+ )
+ smtp_encryption = forms.ChoiceField(choices=ENCRYPTION_CHOICES,
+ initial='OFF',
+ required=False,
+ label=_('Encryption'))
sms_gateway = forms.ChoiceField(
label=_('SMS Gateway'),
diff --git a/servo/models/device.py b/servo/models/device.py
index 95635df..df28671 100644
--- a/servo/models/device.py
+++ b/servo/models/device.py
@@ -188,7 +188,7 @@ class Device(models.Model):
help_text=_('Device is considered vintage in GSX')
)
fmip_active = models.BooleanField(default=False, editable=False)
-
+
def is_apple_device(self):
"""
Checks if this is a valid Apple device SN
@@ -395,7 +395,7 @@ class Device(models.Model):
return self.photo.url
except ValueError:
return self.get_image_url()
-
+
def get_fmip_status(self):
"""
Returns the translated FMiP status
diff --git a/servo/models/note.py b/servo/models/note.py
index a598a95..8b2943f 100644
--- a/servo/models/note.py
+++ b/servo/models/note.py
@@ -382,7 +382,16 @@ class Note(MPTTModel):
if len(smtp_host) > 1:
settings.EMAIL_PORT = int(smtp_host[1])
- settings.EMAIL_USE_TLS = config.get('smtp_ssl')
+ if config.get('SMTP_ENCRYPTION') == 'TLS':
+ settings.EMAIL_USE_TLS = True
+
+ if config.get('SMTP_ENCRYPTION') == 'SSL':
+ settings.EMAIL_USE_SSL = True
+
+ if config.get('SMTP_ENCRYPTION') == 'OFF':
+ settings.EMAIL_USE_SSL = False
+ settings.EMAIL_USE_TLS = False
+
settings.EMAIL_HOST_USER = str(config.get('smtp_user'))
settings.EMAIL_HOST_PASSWORD = str(config.get('smtp_password'))
@@ -630,9 +639,8 @@ class Article(models.Model):
('LOW', _('Low')),
)
priority = models.CharField(max_length=128,
- choices=PRIORITY_CHOICES,
- default=PRIORITY_CHOICES[0][0]
- )
+ choices=PRIORITY_CHOICES,
+ default=PRIORITY_CHOICES[0][0])
url = models.URLField(default='')
product_model = ArrayField(models.CharField(max_length=128),
null=True,
diff --git a/servo/templates/admin/settings.html b/servo/templates/admin/settings.html
index 2656539..85f7b61 100644
--- a/servo/templates/admin/settings.html
+++ b/servo/templates/admin/settings.html
@@ -52,7 +52,7 @@
{% include "form_field_snippet.html" with field=form.smtp_host %}
{% include "form_field_snippet.html" with field=form.smtp_user %}
{% include "form_field_snippet.html" with field=form.smtp_password %}
- {% include "form_field_snippet.html" with field=form.smtp_ssl %}
+ {% include "form_field_snippet.html" with field=form.smtp_encryption %}
</fieldset>
<fieldset>
<legend>{% trans "Notifications" %}</legend>