Author: jezdez
Date: 2011-06-26 09:51:25 -0700 (Sun, 26 Jun 2011)
New Revision: 16454
Modified:
django/trunk/django/contrib/auth/tests/views.py
django/trunk/django/contrib/auth/views.py
Log:
Fixed #15266 -- Applied login_required decorator to password_change_done view.
Thanks, lasko.
Modified: django/trunk/django/contrib/auth/tests/views.py
===================================================================
--- django/trunk/django/contrib/auth/tests/views.py 2011-06-26 16:51:12 UTC
(rev 16453)
+++ django/trunk/django/contrib/auth/tests/views.py 2011-06-26 16:51:25 UTC
(rev 16454)
@@ -193,6 +193,23 @@
self.fail_login()
self.login(password='password1')
+ def test_password_change_done_succeeds(self):
+ self.login()
+ response = self.client.post('/password_change/', {
+ 'old_password': 'password',
+ 'new_password1': 'password1',
+ 'new_password2': 'password1',
+ }
+ )
+ self.assertEqual(response.status_code, 302)
+
self.assertTrue(response['Location'].endswith('/password_change/done/'))
+
+ def test_password_change_done_fails(self):
+ response = self.client.get('/password_change/done/')
+ self.assertEqual(response.status_code, 302)
+
self.assertTrue(response['Location'].endswith('/login/?next=/password_change/done/'))
+
+
class LoginTest(AuthViewsTestCase):
def test_current_site_in_context_after_login(self):
Modified: django/trunk/django/contrib/auth/views.py
===================================================================
--- django/trunk/django/contrib/auth/views.py 2011-06-26 16:51:12 UTC (rev
16453)
+++ django/trunk/django/contrib/auth/views.py 2011-06-26 16:51:25 UTC (rev
16454)
@@ -257,6 +257,7 @@
return TemplateResponse(request, template_name, context,
current_app=current_app)
+@login_required
def password_change_done(request,
template_name='registration/password_change_done.html',
current_app=None, extra_context=None):
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.