mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
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:
committed by
Tim Graham
parent
ad216381fc
commit
dcee1dfc79
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user