changeset 1117:dd57bacde961

Convert password reset to v3 design.
author Brian Neal <bgneal@gmail.com>
date Wed, 20 Jul 2016 20:54:36 -0500
parents 85119508e072
children 0219fafab7a6
files accounts/urls.py sg101/templates/accounts/password_reset.html sg101/templates/accounts/password_reset_complete.html sg101/templates/accounts/password_reset_confirm.html sg101/templates/accounts/password_reset_sent.html
diffstat 5 files changed, 81 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/accounts/urls.py	Tue Jul 19 21:20:44 2016 -0500
+++ b/accounts/urls.py	Wed Jul 20 20:54:36 2016 -0500
@@ -41,24 +41,34 @@
         name='accounts-password_change'),
     url(r'^password/reset/$',
         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/'},
+        kwargs={
+            'template_name': 'accounts/password_reset.html',
+            'email_template_name': 'accounts/password_reset_email.txt',
+            'post_reset_redirect': '/accounts/password/reset/sent/',
+            'extra_context': {'V3_DESIGN': True},
+         },
         name='accounts-password_reset'),
     url(r'^password/reset/sent/$',
         auth_views.password_reset_done,
-        kwargs={'template_name': 'accounts/password_reset_sent.html'},
+        kwargs={
+            'template_name': 'accounts/password_reset_sent.html',
+            'extra_context': {'V3_DESIGN': True},
+        },
         name='accounts-password_reset_sent'),
-    url(r'^password/reset/confirm/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9a-z]+-\w+)/$',
+    url(r'^password/reset/confirm/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
         auth_views.password_reset_confirm,
         kwargs={
             'template_name': 'accounts/password_reset_confirm.html',
             'post_reset_redirect': '/accounts/password/reset/success/',
-            },
+            'extra_context': {'V3_DESIGN': True},
+        },
         name='accounts-password_reset_confirm'),
     url(r'^password/reset/success/$',
         auth_views.password_reset_complete,
-        kwargs={'template_name': 'accounts/password_reset_complete.html'},
+        kwargs={
+            'template_name': 'accounts/password_reset_complete.html',
+            'extra_context': {'V3_DESIGN': True},
+        },
         name='accounts-password_reset_success'),
     url(r'^username/query/$',
         accounts.views.username_query,
--- a/sg101/templates/accounts/password_reset.html	Tue Jul 19 21:20:44 2016 -0500
+++ b/sg101/templates/accounts/password_reset.html	Wed Jul 20 20:54:36 2016 -0500
@@ -1,4 +1,4 @@
-{% extends 'base.html' %}
+{% extends 'v3/base.html' %}
 {% block title %}Reset Password{% endblock %}
 {% block content %}
 <h2>Reset Password</h2>
@@ -6,10 +6,15 @@
 send you instructions on how to reset it. 
 </p>
 <form method="post" action=".">{% csrf_token %}
-<table>
-{{ form.as_table }}
-<tr><td>&nbsp;</td><td><input type="submit" value="Reset Password" />
-      </td></tr>
-</table>
+   {{ form.non_field_errors }}
+   {{ form.email.errors }}
+   <div class="row">
+      <div class="medium-6 columns">
+         <label for="{{ form.email.id_for_label }}">{{ form.email.label }}
+            {{ form.email }}
+         </label>
+      </div>
+   </div>
+   <input type="submit" value="Send Reset Password Email" class="primary button" />
 </form>
 {% endblock %}
--- a/sg101/templates/accounts/password_reset_complete.html	Tue Jul 19 21:20:44 2016 -0500
+++ b/sg101/templates/accounts/password_reset_complete.html	Wed Jul 20 20:54:36 2016 -0500
@@ -1,8 +1,9 @@
-{% extends 'base.html' %}
+{% extends 'v3/base.html' %}
 {% block title %}Password Reset Complete{% endblock %}
 {% block content %}
 <h2>Password Reset Complete</h2>
-<p>
-Your password has been successfully changed. You may now <a href="{% url 'accounts-login' %}">login</a>.
-</p>
+<div class="success callout">
+   Your password has been successfully changed.
+   You may now <a href="{% url 'accounts-login' %}">login</a>.
+</div>
 {% endblock %}
--- a/sg101/templates/accounts/password_reset_confirm.html	Tue Jul 19 21:20:44 2016 -0500
+++ b/sg101/templates/accounts/password_reset_confirm.html	Wed Jul 20 20:54:36 2016 -0500
@@ -1,23 +1,44 @@
-{% extends 'base.html' %}
+{% extends 'v3/base.html' %}
 {% block title %}Reset Password{% endblock %}
 {% block content %}
 <h2>Reset Password</h2>
 {% if validlink %}
-<p>
-Please use the following form to reset your password.
-</p>
-<form method="post" action=".">{% csrf_token %}
-<table>
-{{ form.as_table }}
-<tr><td>&nbsp;</td><td><input type="submit" value="Reset Password" />
-      </td></tr>
-</table>
-</form>
+   <p>
+   Please use the following form to reset your password.
+   </p>
+   <form method="post" action=".">{% csrf_token %}
+      {{ form.non_field_errors }}
+      {{ form.new_password1.errors }}
+      <div class="row">
+         <div class="medium-6 columns">
+            <label for="{{ form.new_password1.id_for_label }}">
+               {{ form.new_password1.label }}
+               {{ form.new_password1 }}
+            </label>
+         </div>
+      </div>
+      {{ form.new_password2.errors }}
+      <div class="row">
+         <div class="medium-6 columns">
+            <label for="{{ form.new_password2.id_for_label }}">
+               {{ form.new_password2.label }}
+               {{ form.new_password2 }}
+            </label>
+         </div>
+      </div>
+      <input type="submit" value="Reset Password" class="primary button" />
+   </form>
 {% else %}
-<p>
-We're sorry, the link you provided is invalid or has expired. If you are trying to
-reset your password, please <a href="{% url 'accounts-password_reset' %}">try again</a>.
-If you have questions or problems, please <a href="{% url 'contact-form' %}">contact us</a>.
-</p>
+   <div class="alert callout">
+      <p>
+      We're sorry, this reset password link is either invalid or has expired.
+      If you are trying to reset your password, please
+      <a href="{% url 'accounts-password_reset' %}">try again</a>.
+      </p>
+      <p>
+      If you have questions or continue to have problems, please
+      <a href="{% url 'contact-form' %}?subject=Reset%20Password">contact us</a>.
+      </p>
+   </div>
 {% endif %}
 {% endblock %}
--- a/sg101/templates/accounts/password_reset_sent.html	Tue Jul 19 21:20:44 2016 -0500
+++ b/sg101/templates/accounts/password_reset_sent.html	Wed Jul 20 20:54:36 2016 -0500
@@ -1,10 +1,15 @@
-{% extends 'base.html' %}
+{% extends 'v3/base.html' %}
 {% block title %}Password Reset Instructions Sent{% endblock %}
 {% block content %}
 <h2>Password Reset Instructions Sent</h2>
-<p>
-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.
-</p>
-<p>If you do not receive the email within a few minutes, please check any spam folders.</p>
+<div class="success callout">
+   <p>
+   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.
+   </p>
+   <p>
+   If you do not receive the email within a few minutes, please check any spam
+   folders.
+   </p>
+</div>
 {% endblock %}