mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +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:
parent
ad216381fc
commit
dcee1dfc79
6 changed files with 43 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue