diff --git a/hosting/templates/hosting/emails/password_reset_email.html b/hosting/templates/hosting/emails/password_reset_email.html index 682834f5..192d043c 100644 --- a/hosting/templates/hosting/emails/password_reset_email.html +++ b/hosting/templates/hosting/emails/password_reset_email.html @@ -1,13 +1,14 @@ -{% load i18n %}{% autoescape off %} -{% blocktrans %}You're receiving this email because you requested a password reset for your user account at {{ site_name }}.{% endblocktrans %} - -{% trans "Please go to the following page and choose a new password:" %} - {% block reset_link %} - {{ base_url }}{% url 'hosting:reset_password_confirm' uidb64=uid token=token %} - {% endblock %} - -{% trans "Thanks for using our site!" %} - -{% blocktrans %}The {{ site_name }} team{% endblocktrans %} - -{% endautoescape %} \ No newline at end of file +{% extends "datacenterlight/emails/base_email_datacenterlight.html" %} +{% load i18n %} +{% block email_head %} +{% trans 'Password Reset' %} +{% endblock %} +{% block email_body %} +{% url 'hosting:reset_password_confirm' uidb64=uid token=token as password_reset_url %} +{% blocktrans %} +You're receiving this email because you requested a password reset for your user account at {{site_name}}. +Please go to the following page and choose a new password: {{base_url}}{{ password_reset_url }} +If you didn't request a new password, ignore this e-mail. +Thank you! +{% endblocktrans %} +{% endblock %} diff --git a/hosting/templates/hosting/emails/password_reset_email.txt b/hosting/templates/hosting/emails/password_reset_email.txt index 682834f5..67ac9a08 100644 --- a/hosting/templates/hosting/emails/password_reset_email.txt +++ b/hosting/templates/hosting/emails/password_reset_email.txt @@ -1,13 +1,14 @@ -{% load i18n %}{% autoescape off %} -{% blocktrans %}You're receiving this email because you requested a password reset for your user account at {{ site_name }}.{% endblocktrans %} - -{% trans "Please go to the following page and choose a new password:" %} - {% block reset_link %} - {{ base_url }}{% url 'hosting:reset_password_confirm' uidb64=uid token=token %} - {% endblock %} - -{% trans "Thanks for using our site!" %} - -{% blocktrans %}The {{ site_name }} team{% endblocktrans %} - -{% endautoescape %} \ No newline at end of file +{% extends "datacenterlight/emails/base_email_datacenterlight.txt" %} +{% load i18n %} +{% block email_head %} +{% trans 'Password Reset' %} +{% endblock %} +{% block email_body %} +{% url 'hosting:reset_password_confirm' uidb64=uid token=token as password_reset_url %} +{% blocktrans with amount=article.price%} +You're receiving this email because you requested a password reset for your user account at {{site_name}}. +Please go to the following page and choose a new password: {{base_url}}{{ password_reset_url }} +If you didn't request a new password, ignore this e-mail. +Thank you! +{% endblocktrans %} +{% endblock %} diff --git a/utils/views.py b/utils/views.py index 039e08d8..011a8491 100644 --- a/utils/views.py +++ b/utils/views.py @@ -1,11 +1,12 @@ from django.views.generic import FormView, CreateView from django.utils.http import urlsafe_base64_encode, urlsafe_base64_decode +from django.conf import settings from django.contrib import messages from django.contrib.auth.tokens import default_token_generator from django.utils.encoding import force_bytes from django.http import HttpResponseRedirect from django.contrib.auth import authenticate, login - +from django.utils.translation import ugettext_lazy as _ from membership.models import CustomUser from .mailer import BaseEmail @@ -65,10 +66,8 @@ class LoginViewMixin(FormView): class PasswordResetViewMixin(FormView): # template_name = 'hosting/reset_password.html' # form_class = PasswordResetRequestForm - success_message = "The link to reset your email has been sent to your email" + success_message = _("The link to reset your email has been sent to your email") site = '' - success_message = "Thank you! You will shortly receive a password reset mail from us" - # success_url = reverse_lazy('hosting:login') def test_generate_email_context(self, user): context = { @@ -82,12 +81,9 @@ class PasswordResetViewMixin(FormView): return context def form_valid(self, form): - email = form.cleaned_data.get('email') user = CustomUser.objects.get(email=email) - messages.add_message(self.request, messages.SUCCESS, self.success_message) - context = self.test_generate_email_context(user) email_data = { 'subject': 'Password Reset', @@ -97,7 +93,7 @@ class PasswordResetViewMixin(FormView): 'template_path': self.template_email_path } if self.site == 'dcl': - email_data['from_address'] = '(Data Center Light) Data Center Light Support ' + email_data['from_address'] = settings.DCL_SUPPORT_FROM_ADDRESS email = BaseEmail(**email_data) email.send()