From 285fa46cb15a8bdab46fd209cc7f37cdd1fb2df4 Mon Sep 17 00:00:00 2001 From: vladimir Date: Tue, 26 Apr 2011 12:17:39 +0400 Subject: [PATCH] added autologout param to logout view --- cas_provider/views.py | 9 ++++++--- setup.py | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cas_provider/views.py b/cas_provider/views.py index 0483a32..c2b3d58 100644 --- a/cas_provider/views.py +++ b/cas_provider/views.py @@ -85,7 +85,10 @@ def service_validate(request): ''', mimetype='text/xml') -def logout(request, template_name='cas/logout.html'): +def logout(request, template_name='cas/logout.html', auto_redirect=False): url = request.GET.get('url', None) - auth_logout(request) - return render_to_response(template_name, {'url': url}, context_instance=RequestContext(request)) \ No newline at end of file + 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)) diff --git a/setup.py b/setup.py index 489f8d2..a9b74ae 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages setup( name='django-cas-provider', - version='0.2', + version='0.2.1', description='A "provider" for the Central Authentication Service (http://jasig.org/cas)', author='Chris Williams', author_email='chris@nitron.org', -- 2.20.1