diff --git a/HISTORY.rst b/HISTORY.rst index 015dde8fc4..bbb1c4f358 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -12,6 +12,9 @@ Change the widget of the email fields in the mailer app to avoid browser side email validation. Closes GitLab issue #530. Thanks to Mark Maglana @relaxdiego for the report. +* Add configuration option to change the project/installation URL. + This is used in the password reset emails and in the default + document mailing templates. 3.1.7 (2018-10-14) ================== diff --git a/mayan/apps/authentication/views.py b/mayan/apps/authentication/views.py index b748daa1af..fdee5d0b90 100644 --- a/mayan/apps/authentication/views.py +++ b/mayan/apps/authentication/views.py @@ -15,7 +15,7 @@ from django.utils.translation import ugettext_lazy as _ from stronghold.decorators import public -from common.settings import setting_project_title +from common.settings import setting_project_title, setting_project_url import mayan from .forms import EmailAuthenticationForm, UsernameAuthenticationForm @@ -153,7 +153,7 @@ def password_reset_view(request): email_template_name='authentication/password_reset_email.html', extra_email_context={ 'project_title': setting_project_title.value, - 'project_website': mayan.__website__, + 'project_website': setting_project_url.value, 'project_copyright': mayan.__copyright__, 'project_license': mayan.__license__, }, subject_template_name='authentication/password_reset_subject.txt', diff --git a/mayan/apps/common/settings.py b/mayan/apps/common/settings.py index ae94234e17..f28ce9cb45 100644 --- a/mayan/apps/common/settings.py +++ b/mayan/apps/common/settings.py @@ -52,6 +52,12 @@ setting_project_title = namespace.add_setting( 'Name to be displayed in the main menu.' ), ) +setting_project_url = namespace.add_setting( + global_name='COMMON_PROJECT_URL', + default=mayan.__website__, help_text=_( + 'URL of the installation or homepage of the project.' + ), +) setting_shared_storage = namespace.add_setting( global_name='COMMON_SHARED_STORAGE', default='django.core.files.storage.FileSystemStorage', diff --git a/mayan/apps/mailer/forms.py b/mayan/apps/mailer/forms.py index 2372a7a91e..a1649a6b1e 100644 --- a/mayan/apps/mailer/forms.py +++ b/mayan/apps/mailer/forms.py @@ -7,7 +7,7 @@ from django.utils.translation import ugettext_lazy as _ from acls.models import AccessControlList from common.forms import DynamicModelForm -from common.settings import setting_project_title +from common.settings import setting_project_title, setting_project_url import mayan @@ -35,7 +35,7 @@ class DocumentMailForm(forms.Form): 'body' ].initial = setting_document_body_template.value % { 'project_title': setting_project_title.value, - 'project_website': mayan.__website__ + 'project_website': setting_project_url.value } else: self.fields[ @@ -43,7 +43,7 @@ class DocumentMailForm(forms.Form): ].initial = setting_link_subject_template.value self.fields['body'].initial = setting_link_body_template.value % { 'project_title': setting_project_title.value, - 'project_website': mayan.__website__ + 'project_website': setting_project_url.value } queryset = AccessControlList.objects.filter_by_access(