0001-views-better-display-password-reset-instructions-380.patch
src/authentic2/templates/registration/password_reset_instructions.html | ||
---|---|---|
1 |
{% extends "authentic2/base-page.html" %} |
|
2 |
{% load i18n gadjo %} |
|
3 | ||
4 |
{% block page-title %} |
|
5 |
{% trans "Password reset instructions" %} |
|
6 |
{% endblock %} |
|
7 | ||
8 |
{% block content %} |
|
9 |
<p><strong> |
|
10 |
{% blocktrans with email=request.session.reset_email %} |
|
11 |
If your email address exists in ou database, an email has been sent to {{ email }}. |
|
12 |
{% endblocktrans %} |
|
13 |
</strong></p> |
|
14 |
<p><strong> |
|
15 |
{% blocktrans %} |
|
16 |
Follow the instructions in this email in order to choose a new password. |
|
17 |
{% endblocktrans %} |
|
18 |
</strong></p> |
|
19 |
<p> |
|
20 |
{% blocktrans %} |
|
21 |
Note that it can take several minutes to be delivered. Please check your spam folder if you haven't received it by then. |
|
22 |
{% endblocktrans %} |
|
23 |
</p> |
|
24 |
<a type=button href="/login/">{% trans "Back to login" %}</a> |
|
25 |
{% endblock %} |
src/authentic2/urls.py | ||
---|---|---|
81 | 81 |
url(r'^password/reset/$', |
82 | 82 |
views.password_reset, |
83 | 83 |
name='password_reset'), |
84 |
url(r'^password/reset/instructions/$', |
|
85 |
views.password_reset_instructions, |
|
86 |
name='password_reset_instructions'), |
|
84 | 87 | |
85 | 88 |
# Legacy, only there to provide old view names to resolver |
86 | 89 |
url(r'^password/change/$', |
src/authentic2/views.py | ||
---|---|---|
626 | 626 |
return HttpResponseRedirect(request.get_full_path()) |
627 | 627 | |
628 | 628 | |
629 |
class PasswordResetView(cbv.NextURLViewMixin, FormView):
|
|
629 |
class PasswordResetView(FormView): |
|
630 | 630 |
'''Ask for an email and send a password reset link by mail''' |
631 | 631 |
form_class = passwords_forms.PasswordResetForm |
632 | 632 |
title = _('Password Reset') |
633 |
next_url_default = '/' |
|
633 | ||
634 |
def get_success_url(self): |
|
635 |
return reverse('password_reset_instructions') |
|
634 | 636 | |
635 | 637 |
def get_template_names(self): |
636 | 638 |
return [ |
... | ... | |
653 | 655 | |
654 | 656 |
def form_valid(self, form): |
655 | 657 |
form.save() |
656 |
# return to next URL |
|
657 |
messages.info(self.request, _('If your email address exists in our ' |
|
658 |
'database, you will receive an email ' |
|
659 |
'containing instructions to reset ' |
|
660 |
'your password')) |
|
658 |
self.request.session['reset_email'] = form.cleaned_data['email'] |
|
661 | 659 |
return super(PasswordResetView, self).form_valid(form) |
662 | 660 | |
663 | 661 |
password_reset = PasswordResetView.as_view() |
664 | 662 | |
665 | 663 | |
664 |
class PasswordResetInstructionsView(TemplateView): |
|
665 |
template_name = 'registration/password_reset_instructions.html' |
|
666 | ||
667 | ||
668 |
password_reset_instructions = PasswordResetInstructionsView.as_view() |
|
669 | ||
670 | ||
666 | 671 |
class PasswordResetConfirmView(cbv.RedirectToNextURLViewMixin, FormView): |
667 | 672 |
'''Validate password reset link, show a set password form and login |
668 | 673 |
the user. |
669 |
- |