Fixed #28513 -- Added POST request support to LogoutView.
This commit is contained in:
parent
da0fb5b1ec
commit
c0f4c60edd
|
@ -133,6 +133,10 @@ class LogoutView(SuccessURLAllowedHostsMixin, TemplateView):
|
||||||
return HttpResponseRedirect(next_page)
|
return HttpResponseRedirect(next_page)
|
||||||
return super().dispatch(request, *args, **kwargs)
|
return super().dispatch(request, *args, **kwargs)
|
||||||
|
|
||||||
|
def post(self, request, *args, **kwargs):
|
||||||
|
"""Logout may be done via POST."""
|
||||||
|
return self.get(request, *args, **kwargs)
|
||||||
|
|
||||||
def get_next_page(self):
|
def get_next_page(self):
|
||||||
if self.next_page is not None:
|
if self.next_page is not None:
|
||||||
next_page = resolve_url(self.next_page)
|
next_page = resolve_url(self.next_page)
|
||||||
|
|
|
@ -23,3 +23,6 @@ Bugfixes
|
||||||
requires an update to Oracle tables created with Django 1.11.[1-4]. Use the
|
requires an update to Oracle tables created with Django 1.11.[1-4]. Use the
|
||||||
upgrade script in :ticket:`28451` comment 8 to update sequence and trigger
|
upgrade script in :ticket:`28451` comment 8 to update sequence and trigger
|
||||||
names to use the pre-1.11 naming scheme.
|
names to use the pre-1.11 naming scheme.
|
||||||
|
|
||||||
|
* Added POST request support to ``LogoutView``, for equivalence with the
|
||||||
|
function-based ``logout()`` view (:ticket:`28513`).
|
||||||
|
|
|
@ -922,6 +922,12 @@ class LogoutTest(AuthViewsTestCase):
|
||||||
self.assertContains(response, 'Logged out')
|
self.assertContains(response, 'Logged out')
|
||||||
self.confirm_logged_out()
|
self.confirm_logged_out()
|
||||||
|
|
||||||
|
def test_logout_with_post(self):
|
||||||
|
self.login()
|
||||||
|
response = self.client.post('/logout/')
|
||||||
|
self.assertContains(response, 'Logged out')
|
||||||
|
self.confirm_logged_out()
|
||||||
|
|
||||||
def test_14377(self):
|
def test_14377(self):
|
||||||
# Bug 14377
|
# Bug 14377
|
||||||
self.login()
|
self.login()
|
||||||
|
|
Loading…
Reference in New Issue