Fixed #12405 -- Added LOGOUT_REDIRECT_URL setting.

After a user logs out via auth.views.logout(), they're redirected
to LOGOUT_REDIRECT_URL if no `next_page` argument is provided.
This commit is contained in:
Hugo Osvaldo Barrera 2015-08-26 03:07:06 -03:00 committed by Tim Graham
parent ad216381fc
commit dcee1dfc79
6 changed files with 43 additions and 1 deletions

View file

@ -878,6 +878,18 @@ class LogoutTest(AuthViewsTestCase):
self.client.get('/logout/')
self.assertEqual(self.client.session[LANGUAGE_SESSION_KEY], 'pl')
@override_settings(LOGOUT_REDIRECT_URL='/custom/')
def test_logout_redirect_url_setting(self):
self.login()
response = self.client.get('/logout/')
self.assertRedirects(response, '/custom/', fetch_redirect_response=False)
@override_settings(LOGOUT_REDIRECT_URL='logout')
def test_logout_redirect_url_named_setting(self):
self.login()
response = self.client.get('/logout/')
self.assertRedirects(response, '/logout/', fetch_redirect_response=False)
# Redirect in test_user_change_password will fail if session auth hash
# isn't updated after password change (#21649)