X-Git-Url: https://git.mdrn.pl/django-cas-provider.git/blobdiff_plain/fdd4b59a0a825cf8fa38e94123d118b57707b067..58ced7c998424be00d9a0aa7db4c9aed14fdd730:/cas_provider/views.py?ds=inline diff --git a/cas_provider/views.py b/cas_provider/views.py index 4a7e9b8..c9a44db 100644 --- a/cas_provider/views.py +++ b/cas_provider/views.py @@ -79,9 +79,13 @@ def validate(request): return HttpResponse("no\n\n") -def logout(request, template_name='cas/logout.html'): +def logout(request, template_name='cas/logout.html', \ + auto_redirect=settings.CAS_AUTO_REDIRECT_AFTER_LOGOUT): url = request.GET.get('url', None) - auth_logout(request) + if request.user.is_authenticated(): + auth_logout(request) + if url and auto_redirect: + return HttpResponseRedirect(url) return render_to_response(template_name, {'url': url}, \ context_instance=RequestContext(request))