diff --git a/HISTORY.rst b/HISTORY.rst index 71ae0306d5..024948f6dc 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -5,6 +5,12 @@ * Fix mailing profile log columns mappings. GitLab issue #626. Thanks to Jesaja Everling (@jeverling) for the report. +* Fix the Django SMTP backend username field name. + GitLab issue #625. Thanks to Jesaja Everling (@jeverling) + for the report and the research. +* Increase the Django STMP username. + GitLab issue #625. Thanks to Jesaja Everling (@jeverling) + for the report and the research. 3.2.2 (2019-06-19) ================== diff --git a/docs/releases/3.2.3.rst b/docs/releases/3.2.3.rst index afa995fedc..4dca435e4f 100644 --- a/docs/releases/3.2.3.rst +++ b/docs/releases/3.2.3.rst @@ -12,6 +12,12 @@ Changes - Fix mailing profile log columns mappings. GitLab issue #626. Thanks to Jesaja Everling (@jeverling) for the report. +- Fix the Django SMTP backend username field name. + GitLab issue #625. Thanks to Jesaja Everling (@jeverling) + for the report and the research. +- Increase the Django STMP username. + GitLab issue #625. Thanks to Jesaja Everling (@jeverling) + for the report and the research. Removals @@ -101,6 +107,7 @@ Backward incompatible changes Bugs fixed or issues closed --------------------------- +- :gitlab-issue:`625` mayan.apps.mailer.mailers.DjangoSMTP uses "user", but django.core.mail.backends.smtp.EmailBackend expects "username" - :gitlab-issue:`626` Mailing profile error log is empty, despite errors .. _PyPI: https://pypi.python.org/pypi/mayan-edms/ diff --git a/mayan/apps/mailer/forms.py b/mayan/apps/mailer/forms.py index e2f51b339c..4373b2a3ab 100644 --- a/mayan/apps/mailer/forms.py +++ b/mayan/apps/mailer/forms.py @@ -96,7 +96,7 @@ class UserMailerDynamicForm(DynamicModelForm): if self.instance.backend_data: backend_data = json.loads(self.instance.backend_data) for key in self.instance.get_backend().fields: - self.fields[key].initial = backend_data[key] + self.fields[key].initial = backend_data.get(key) return result diff --git a/mayan/apps/mailer/mailers.py b/mayan/apps/mailer/mailers.py index 9e4660f2ba..4407c7e9b0 100644 --- a/mayan/apps/mailer/mailers.py +++ b/mayan/apps/mailer/mailers.py @@ -12,11 +12,11 @@ class DjangoSMTP(MailerBackend): Backend that wraps Django's SMTP backend """ class_fields = ( - 'host', 'port', 'use_tls', 'use_ssl', 'user', 'password' + 'host', 'port', 'use_tls', 'use_ssl', 'username', 'password' ) class_path = 'django.core.mail.backends.smtp.EmailBackend' field_order = ( - 'host', 'port', 'use_tls', 'use_ssl', 'user', 'password', 'from' + 'host', 'port', 'use_tls', 'use_ssl', 'username', 'password', 'from' ) fields = { 'from': { @@ -60,14 +60,14 @@ class DjangoSMTP(MailerBackend): 'that "Use TLS" and "Use SSL" are mutually exclusive, ' 'so only set one of those settings to True.' ), 'required': False - }, 'user': { + }, 'username': { 'label': _('Username'), 'class': 'django.forms.CharField', 'default': '', 'help_text': _( 'Username to use for the SMTP server. If empty, ' 'authentication won\'t attempted.' ), 'kwargs': { - 'max_length': 48 + 'max_length': 254 }, 'required': False }, 'password': { 'label': _('Password'),