Updated password reset template
This commit is contained in:
parent
5381e0fa67
commit
7c70ee637a
3 changed files with 32 additions and 34 deletions
|
@ -1,13 +1,14 @@
|
||||||
{% load i18n %}{% autoescape off %}
|
{% extends "datacenterlight/emails/base_email_datacenterlight.html" %}
|
||||||
{% blocktrans %}You're receiving this email because you requested a password reset for your user account at {{ site_name }}.{% endblocktrans %}
|
{% load i18n %}
|
||||||
|
{% block email_head %}
|
||||||
{% trans "Please go to the following page and choose a new password:" %}
|
{% trans 'Password Reset' %}
|
||||||
{% block reset_link %}
|
{% endblock %}
|
||||||
{{ base_url }}{% url 'hosting:reset_password_confirm' uidb64=uid token=token %}
|
{% block email_body %}
|
||||||
{% endblock %}
|
{% url 'hosting:reset_password_confirm' uidb64=uid token=token as password_reset_url %}
|
||||||
|
{% blocktrans %}
|
||||||
{% trans "Thanks for using our site!" %}
|
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 }}
|
||||||
{% blocktrans %}The {{ site_name }} team{% endblocktrans %}
|
If you didn't request a new password, ignore this e-mail.
|
||||||
|
Thank you!
|
||||||
{% endautoescape %}
|
{% endblocktrans %}
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
{% load i18n %}{% autoescape off %}
|
{% extends "datacenterlight/emails/base_email_datacenterlight.txt" %}
|
||||||
{% blocktrans %}You're receiving this email because you requested a password reset for your user account at {{ site_name }}.{% endblocktrans %}
|
{% load i18n %}
|
||||||
|
{% block email_head %}
|
||||||
{% trans "Please go to the following page and choose a new password:" %}
|
{% trans 'Password Reset' %}
|
||||||
{% block reset_link %}
|
{% endblock %}
|
||||||
{{ base_url }}{% url 'hosting:reset_password_confirm' uidb64=uid token=token %}
|
{% block email_body %}
|
||||||
{% endblock %}
|
{% url 'hosting:reset_password_confirm' uidb64=uid token=token as password_reset_url %}
|
||||||
|
{% blocktrans with amount=article.price%}
|
||||||
{% trans "Thanks for using our site!" %}
|
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 }}
|
||||||
{% blocktrans %}The {{ site_name }} team{% endblocktrans %}
|
If you didn't request a new password, ignore this e-mail.
|
||||||
|
Thank you!
|
||||||
{% endautoescape %}
|
{% endblocktrans %}
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
from django.views.generic import FormView, CreateView
|
from django.views.generic import FormView, CreateView
|
||||||
from django.utils.http import urlsafe_base64_encode, urlsafe_base64_decode
|
from django.utils.http import urlsafe_base64_encode, urlsafe_base64_decode
|
||||||
|
from django.conf import settings
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.contrib.auth.tokens import default_token_generator
|
from django.contrib.auth.tokens import default_token_generator
|
||||||
from django.utils.encoding import force_bytes
|
from django.utils.encoding import force_bytes
|
||||||
from django.http import HttpResponseRedirect
|
from django.http import HttpResponseRedirect
|
||||||
from django.contrib.auth import authenticate, login
|
from django.contrib.auth import authenticate, login
|
||||||
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from membership.models import CustomUser
|
from membership.models import CustomUser
|
||||||
|
|
||||||
from .mailer import BaseEmail
|
from .mailer import BaseEmail
|
||||||
|
@ -65,10 +66,8 @@ class LoginViewMixin(FormView):
|
||||||
class PasswordResetViewMixin(FormView):
|
class PasswordResetViewMixin(FormView):
|
||||||
# template_name = 'hosting/reset_password.html'
|
# template_name = 'hosting/reset_password.html'
|
||||||
# form_class = PasswordResetRequestForm
|
# 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 = ''
|
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):
|
def test_generate_email_context(self, user):
|
||||||
context = {
|
context = {
|
||||||
|
@ -82,12 +81,9 @@ class PasswordResetViewMixin(FormView):
|
||||||
return context
|
return context
|
||||||
|
|
||||||
def form_valid(self, form):
|
def form_valid(self, form):
|
||||||
|
|
||||||
email = form.cleaned_data.get('email')
|
email = form.cleaned_data.get('email')
|
||||||
user = CustomUser.objects.get(email=email)
|
user = CustomUser.objects.get(email=email)
|
||||||
|
|
||||||
messages.add_message(self.request, messages.SUCCESS, self.success_message)
|
messages.add_message(self.request, messages.SUCCESS, self.success_message)
|
||||||
|
|
||||||
context = self.test_generate_email_context(user)
|
context = self.test_generate_email_context(user)
|
||||||
email_data = {
|
email_data = {
|
||||||
'subject': 'Password Reset',
|
'subject': 'Password Reset',
|
||||||
|
@ -97,7 +93,7 @@ class PasswordResetViewMixin(FormView):
|
||||||
'template_path': self.template_email_path
|
'template_path': self.template_email_path
|
||||||
}
|
}
|
||||||
if self.site == 'dcl':
|
if self.site == 'dcl':
|
||||||
email_data['from_address'] = '(Data Center Light) Data Center Light Support <support@datacenterlight.ch>'
|
email_data['from_address'] = settings.DCL_SUPPORT_FROM_ADDRESS
|
||||||
email = BaseEmail(**email_data)
|
email = BaseEmail(**email_data)
|
||||||
email.send()
|
email.send()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue