From: aldot Date: Tue, 10 Nov 2015 20:53:09 +0000 (+0100) Subject: login: add link to password reset X-Git-Tag: v1.1.0~105 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fba8cda0fdc80d0ebf84d84c781e878b52fc4981;p=thirdparty%2Fpatchwork.git login: add link to password reset Refurbished version from 2010 Doesn't mention the username in the mail but in the confirmation step. Essentially the templates are all optional but they do look better (and more integrated in patchwork) than the default django admin thing. No testing beyond some bored clicking here and there. Signed-off-by: Bernhard Reutner-Fischer Acked-by: Stephen Finucane --- diff --git a/patchwork/templates/patchwork/login.html b/patchwork/templates/patchwork/login.html index 1f000e7d..a28cd31b 100644 --- a/patchwork/templates/patchwork/login.html +++ b/patchwork/templates/patchwork/login.html @@ -25,9 +25,14 @@ {% endif %} {{ form }} - + + + + Forgot password? + + diff --git a/patchwork/urls.py b/patchwork/urls.py index b28eb90b..d6c2501d 100644 --- a/patchwork/urls.py +++ b/patchwork/urls.py @@ -52,6 +52,17 @@ urlpatterns = patterns('', name='password_change'), url(r'^user/password-change/done/$', auth_views.password_change_done, name='password_change_done'), + url(r'^user/password-reset/$', auth_views.password_reset, + name='password_reset'), + url(r'^user/password-reset/mail-sent/$', auth_views.password_reset_done, + name='password_reset_done'), + url(r'^user/password-reset/(?P[0-9A-Za-z_\-]+)/' + r'(?P[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', + auth_views.password_reset_confirm, + name='password_reset_confirm'), + url(r'^user/password-reset/complete/$', + auth_views.password_reset_complete, + name='password_reset_complete'), # login/logout url(r'^user/login/$', auth_views.login, diff --git a/templates/registration/password_reset_complete.html b/templates/registration/password_reset_complete.html new file mode 100644 index 00000000..1d88fdff --- /dev/null +++ b/templates/registration/password_reset_complete.html @@ -0,0 +1,9 @@ +{% extends "base.html" %} + +{% block title %}Password reset completed{% endblock %} +{% block heading %}Password reset completed{% endblock %} + +{% block body %} + +

Your password has been set. You may go ahead and log in now.

+{% endblock %} diff --git a/templates/registration/password_reset_confirm.html b/templates/registration/password_reset_confirm.html new file mode 100644 index 00000000..7e1e2f1e --- /dev/null +++ b/templates/registration/password_reset_confirm.html @@ -0,0 +1,51 @@ +{% extends "base.html" %} + +{% block title %}Password reset confirmation{% endblock %} +{% block heading %}Password reset confirmation{% endblock %} + +{% block body %} + +{% if validlink %} +

Your username, in case you've forgotten: {{ form.user.get_username }}

+

Please enter your new password twice so we can verify you typed it in +correctly

+ +
+{% csrf_token %} + + + +{% if form.errors %} + + +{% endif %} + + +{% for field in form %} + + + + +{% endfor %} + + + + + +
Please correct the errors below.

+
{{ field.label_tag }} + {{ field.errors }} + {{ field }} +{% if field.help_text %} +
{{ field.help_text }}
+{% endif %} +
+ +
+ +
+{% else %} +

The password reset link was invalid, possibly because it has already +been used. Please request a new password reset.

+{% endif %} +{% endblock %} diff --git a/templates/registration/password_reset_done.html b/templates/registration/password_reset_done.html new file mode 100644 index 00000000..fe9e551a --- /dev/null +++ b/templates/registration/password_reset_done.html @@ -0,0 +1,13 @@ +{% extends "base.html" %} + +{% block title %}Password reset{% endblock %} +{% block heading %}Password reset{% endblock %} + +{% block body %} + +

We have emailed you instructions for setting your password. +You should be receiving them shortly.

+

If you don't receive an email, please make sure you've entered the +address you registered with, and check your spam folder

+ +{% endblock %} diff --git a/templates/registration/password_reset_email.html b/templates/registration/password_reset_email.html new file mode 100644 index 00000000..fa399a44 --- /dev/null +++ b/templates/registration/password_reset_email.html @@ -0,0 +1,12 @@ +{% autoescape off %}Hi, + +You are receiving this email because you requested a password reset for +your user account on the patchwork patch-tracking system. +Please visit the following url and choose a new password: + +{% block reset_link %} +{{ protocol }}://{{domain}}{% url 'password_reset_confirm' uidb64=uid token=token %} +{% endblock %} + +Happy patchworking. +{% endautoescape %} diff --git a/templates/registration/password_reset_form.html b/templates/registration/password_reset_form.html new file mode 100644 index 00000000..4718f436 --- /dev/null +++ b/templates/registration/password_reset_form.html @@ -0,0 +1,45 @@ +{% extends "base.html" %} + +{% block title %}Password reset{% endblock %} +{% block heading %}Password reset{% endblock %} + +{% block body %} + +

Forgotten your password? Enter your email address below, and we will +email instructions for setting a new one.

+ +
+{% csrf_token %} + + + +{% if form.errors %} + + +{% endif %} + + +{% for field in form %} + + + + +{% endfor %} + + + + + +
Please correct the errors below.

+
{{ field.label_tag }} + {{ field.errors }} + {{ field }} +{% if field.help_text %} +
{{ field.help_text }}
+{% endif %} +
+ +
+ +
+{% endblock %}