changeset 1116:85119508e072

Convert password change to V3 design.
author Brian Neal <bgneal@gmail.com>
date Tue, 19 Jul 2016 21:20:44 -0500
parents d613d25a021e
children dd57bacde961
files accounts/urls.py sg101/templates/accounts/password_change.html
diffstat 2 files changed, 33 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/accounts/urls.py	Tue Jul 12 21:31:09 2016 -0500
+++ b/accounts/urls.py	Tue Jul 19 21:20:44 2016 -0500
@@ -2,7 +2,6 @@
 from django.conf.urls import url
 from django.conf import settings
 import django.contrib.auth.views as auth_views
-from django.views.generic import TemplateView
 
 import accounts.views
 
@@ -34,8 +33,11 @@
         name='accounts-logout'),
     url(r'^password/$',
         auth_views.password_change,
-        {'template_name': 'accounts/password_change.html',
-         'post_change_redirect': settings.LOGIN_REDIRECT_URL},
+        kwargs={
+            'template_name': 'accounts/password_change.html',
+            'post_change_redirect': settings.LOGIN_REDIRECT_URL,
+            'extra_context': {'V3_DESIGN': True},
+        },
         name='accounts-password_change'),
     url(r'^password/reset/$',
         auth_views.password_reset,
--- a/sg101/templates/accounts/password_change.html	Tue Jul 12 21:31:09 2016 -0500
+++ b/sg101/templates/accounts/password_change.html	Tue Jul 19 21:20:44 2016 -0500
@@ -1,13 +1,34 @@
-{% extends 'base.html' %}
+{% extends 'v3/base.html' %}
 {% block title %}Change Password{% endblock %}
 {% block content %}
 <h2>Change Password</h2>
 <form method="post" action=".">{% csrf_token %}
-<table>
-{{ form.as_table }}
-<tr><td>&nbsp;</td><td><input type="submit" value="Change Password" />
-      &nbsp;<a href="{% url 'bio-me' %}">Cancel</a>
-      </td></tr>
-</table>
+   {{ form.non_field_errors }}
+   {{ form.old_password.errors }}
+   <div class="row">
+      <div class="medium-6 columns">
+         <label for="{{ form.old_password.id_for_label }}">{{ form.old_password.label }}
+            {{ form.old_password }}
+         </label>
+      </div>
+   </div>
+   {{ 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="Change Password" class="primary button" />
+   <a href="{% url 'bio-me' %}" class="secondary button">Cancel</a>
 </form>
 {% endblock %}