Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #15266 -- Applied login_required decorator to password_change_d…

…one view. Thanks, lasko.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16454 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 821d8aaaaad3f4d11f29eb54a7812f363b5f07cb 1 parent 650739e
Jannis Leidel authored June 26, 2011
17  django/contrib/auth/tests/views.py
@@ -193,6 +193,23 @@ def test_password_change_succeeds(self):
193 193
         self.fail_login()
194 194
         self.login(password='password1')
195 195
 
  196
+    def test_password_change_done_succeeds(self):
  197
+        self.login()
  198
+        response = self.client.post('/password_change/', {
  199
+            'old_password': 'password',
  200
+            'new_password1': 'password1',
  201
+            'new_password2': 'password1',
  202
+            }
  203
+        )
  204
+        self.assertEqual(response.status_code, 302)
  205
+        self.assertTrue(response['Location'].endswith('/password_change/done/'))
  206
+
  207
+    def test_password_change_done_fails(self):
  208
+        response = self.client.get('/password_change/done/')
  209
+        self.assertEqual(response.status_code, 302)
  210
+        self.assertTrue(response['Location'].endswith('/login/?next=/password_change/done/'))
  211
+
  212
+
196 213
 class LoginTest(AuthViewsTestCase):
197 214
 
198 215
     def test_current_site_in_context_after_login(self):
1  django/contrib/auth/views.py
@@ -257,6 +257,7 @@ def password_change(request,
257 257
     return TemplateResponse(request, template_name, context,
258 258
                             current_app=current_app)
259 259
 
  260
+@login_required
260 261
 def password_change_done(request,
261 262
                          template_name='registration/password_change_done.html',
262 263
                          current_app=None, extra_context=None):

0 notes on commit 821d8aa

Please sign in to comment.
Something went wrong with that request. Please try again.