Use url parameter on logout

This commit is contained in:
Valentin Samir 2015-06-07 16:53:27 +02:00
parent 5e54ffcc46
commit aa5bb7ef72

View file

@ -84,11 +84,15 @@ class LogoutView(View, LogoutMixin):
"""methode called on GET request on this view""" """methode called on GET request on this view"""
self.request = request self.request = request
self.service = request.GET.get('service') self.service = request.GET.get('service')
self.url = request.GET.get('url')
self.logout() self.logout()
# if service is set, redirect to service after logout # if service is set, redirect to service after logout
if self.service: if self.service:
list(messages.get_messages(request)) # clean messages before leaving the django app list(messages.get_messages(request)) # clean messages before leaving the django app
return HttpResponseRedirect(self.service) return HttpResponseRedirect(self.service)
elif self.url:
list(messages.get_messages(request)) # clean messages before leaving the django app
return HttpResponseRedirect(self.url)
# else redirect to login page # else redirect to login page
else: else:
if settings.CAS_REDIRECT_TO_LOGIN_AFTER_LOGOUT: if settings.CAS_REDIRECT_TO_LOGIN_AFTER_LOGOUT: