# HG changeset patch # User Brian Neal # Date 1247421764 0 # Node ID 4edfea7f862039d7b9259eb12d3dedca36abfd67 # Parent d5eed0a91a05ed0f78766a880285aadf7afe89be #29 - Implementing the forgotten password reset process. diff -r d5eed0a91a05 -r 4edfea7f8620 gpp/accounts/urls.py --- a/gpp/accounts/urls.py Fri Jul 10 23:56:02 2009 +0000 +++ b/gpp/accounts/urls.py Sun Jul 12 18:02:44 2009 +0000 @@ -9,17 +9,38 @@ ) urlpatterns += patterns('', - url(r'^login/', + url(r'^login/$', 'django.contrib.auth.views.login', kwargs={'template_name': 'accounts/login.html'}, name='accounts-login'), - url(r'^logout/', + url(r'^logout/$', 'django.contrib.auth.views.logout', kwargs={'template_name': 'accounts/logout.html'}, name='accounts-logout'), - (r'^password/', + (r'^password/$', 'django.contrib.auth.views.password_change', {'template_name': 'accounts/password_change.html', 'post_change_redirect': settings.LOGIN_REDIRECT_URL}), + url(r'^password/reset/$', + 'django.contrib.auth.views.password_reset', + kwargs={'template_name': 'accounts/password_reset.html', + 'email_template_name': 'accounts/password_reset_email.txt', + 'post_reset_redirect': '/accounts/password/reset/sent/'}, + name='accounts-password_reset'), + url(r'^password/reset/sent/$', + 'django.contrib.auth.views.password_reset_done', + kwargs={'template_name': 'accounts/password_reset_sent.html'}, + name='accounts-password_reset_sent'), + url(r'^password/reset/confirm/(?P[0-9a-z]+)/(?P[0-9a-z]+-\w+)/$', + 'django.contrib.auth.views.password_reset_confirm', + kwargs={ + 'template_name': 'accounts/password_reset_confirm.html', + 'post_reset_redirect': '/accounts/password/reset/success/', + }, + name='accounts-password_reset_confirm'), + url(r'^password/reset/success/$', + 'django.contrib.auth.views.password_reset_complete', + kwargs={'template_name': 'accounts/password_reset_complete.html'}, + name='accounts-password_reset_success'), ) diff -r d5eed0a91a05 -r 4edfea7f8620 gpp/templates/accounts/login.html --- a/gpp/templates/accounts/login.html Fri Jul 10 23:56:02 2009 +0000 +++ b/gpp/templates/accounts/login.html Sun Jul 12 18:02:44 2009 +0000 @@ -14,7 +14,7 @@ -

Forgot your password? You can reset it here.

-

Don't have an account? Why don't you register?

+

Forgot your password? You can reset it here.

+

Don't have an account? Why don't you register?

{% endblock %} diff -r d5eed0a91a05 -r 4edfea7f8620 gpp/templates/accounts/password_reset.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gpp/templates/accounts/password_reset.html Sun Jul 12 18:02:44 2009 +0000 @@ -0,0 +1,15 @@ +{% extends 'base.html' %} +{% block title %}Reset Password{% endblock %} +{% block content %} +

Reset Password

+

Forgot your password? No problem. Just enter your email address and we will +email you instructions on how to reset it. +

+
+ +{{ form.as_table }} + +
  +
+
+{% endblock %} diff -r d5eed0a91a05 -r 4edfea7f8620 gpp/templates/accounts/password_reset_complete.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gpp/templates/accounts/password_reset_complete.html Sun Jul 12 18:02:44 2009 +0000 @@ -0,0 +1,8 @@ +{% extends 'base.html' %} +{% block title %}Password Reset Complete{% endblock %} +{% block content %} +

Password Reset Complete

+

+Your password has been successfully changed. You may now login. +

+{% endblock %} diff -r d5eed0a91a05 -r 4edfea7f8620 gpp/templates/accounts/password_reset_email.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gpp/templates/accounts/password_reset_email.txt Sun Jul 12 18:02:44 2009 +0000 @@ -0,0 +1,11 @@ +Hello, + +{{ site_name }} has received a request to reset the password for the user '{{ user }}'. If you didn't request this change, you can safely ignore this email. + +If you did request a password reset, please visit the following link, where you will be able to enter your new password: + +{{ protocol }}://{{ domain }}/accounts/password/reset/confirm/{{ uid }}/{{ token }}/ + +Regards, + +The staff at {{ site_name }} diff -r d5eed0a91a05 -r 4edfea7f8620 gpp/templates/accounts/password_reset_sent.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gpp/templates/accounts/password_reset_sent.html Sun Jul 12 18:02:44 2009 +0000 @@ -0,0 +1,10 @@ +{% extends 'base.html' %} +{% block title %}Password Reset Instructions Sent{% endblock %} +{% block content %} +

Password Reset Instructions Sent

+

+Instructions on how to reset your password have been sent to your email address. Please visit the +link provided in the email to reset your password. +

+

If you do not receive the email within a few minutes, please check any spam folders.

+{% endblock %}