Handle LOGOUT_URL=None in the logout view

The view used to crash when `LOGOUT_URL` was not set and the user was
connect via CAS.

Cause: we assumed the result of `LogoutView.get_next_page()` to be a
  string and tried to prepend the domain name of the site to it.

Fix: redirect to the CAS' logout view without any `next_page` parameter.
This commit is contained in:
Martin Pépin 2021-10-02 17:02:30 +02:00
parent 47f99f487e
commit acea5a6f4e
No known key found for this signature in database
GPG key ID: E7520278B1774448

View file

@ -145,7 +145,7 @@ class LogoutView(auth_views.LogoutView):
# If the next_url is local (no hostname), make it absolute so that the user
# is correctly redirected from CAS.
if not urlparse(next_page).netloc:
if next_page and not urlparse(next_page).netloc:
request = self.request
next_page = urlunparse(
(request.scheme, request.get_host(), next_page, "", "", "")