diff --git a/README.rst b/README.rst index b7a257d..6d7bd9c 100644 --- a/README.rst +++ b/README.rst @@ -13,7 +13,7 @@ are listed in default_settings.py The defaut login/logout template use `django-bootstrap3 `_ but you can use your own templates using the CAS_LOGIN_TEMPLATE, -CAS_LOGGED_TEMPLATE and CAS_WARN_TEMPLATE setting variables. +CAS_LOGGED_TEMPLATE, CAS_WARN_TEMPLATE and CAS_LOGOUT_TEMPLATEsetting variables. Quick start ----------- diff --git a/cas_server/default_settings.py b/cas_server/default_settings.py index 0d047b6..a476214 100644 --- a/cas_server/default_settings.py +++ b/cas_server/default_settings.py @@ -19,11 +19,13 @@ def setting_default(name, default_value): setting_default('CAS_LOGIN_TEMPLATE', 'cas_server/login.html') setting_default('CAS_WARN_TEMPLATE', 'cas_server/warn.html') setting_default('CAS_LOGGED_TEMPLATE', 'cas_server/logged.html') +setting_default('CAS_LOGOUT_TEMPLATE', 'cas_server/logout.html') setting_default('CAS_AUTH_CLASS', 'cas_server.auth.DjangoAuthUser') setting_default('CAS_ST_LEN', 30) setting_default('CAS_TICKET_VALIDITY', 300) setting_default('CAS_TICKET_TIMEOUT', 24*3600) setting_default('CAS_PROXY_CA_CERTIFICATE_PATH', True) +setting_default('CAS_REDIRECT_TO_LOGIN_AFTER_LOGOUT', False) setting_default('CAS_SERVICE_TICKET_PREFIX', 'ST') setting_default('CAS_PROXY_TICKET_PREFIX', 'PT') diff --git a/cas_server/templates/cas_server/logout.html b/cas_server/templates/cas_server/logout.html new file mode 100644 index 0000000..7b5fdba --- /dev/null +++ b/cas_server/templates/cas_server/logout.html @@ -0,0 +1,20 @@ +{% extends "cas_server/base.html" %} +{% load bootstrap3 %} +{% load staticfiles %} +{% load i18n %} +{% block bootstrap3_extra_head %} + +{% endblock %} +{% block bootstrap3_content %} +
+
+
+
+{% bootstrap_messages %} + +
+
+
+
+{% endblock %} + diff --git a/cas_server/views.py b/cas_server/views.py index 5403b2f..4713008 100644 --- a/cas_server/views.py +++ b/cas_server/views.py @@ -91,8 +91,11 @@ class LogoutView(View, LogoutMixin): return HttpResponseRedirect(self.service) # else redirect to login page else: - messages.add_message(request, messages.SUCCESS, _(u'Successfully logout')) - return redirect("cas_server:login") + if settings.CAS_REDIRECT_TO_LOGIN_AFTER_LOGOUT: + messages.add_message(request, messages.SUCCESS, _(u'Successfully logout')) + return redirect("cas_server:login") + else: + return render(request, settings.CAS_LOGOUT_TEMPLATE) class LoginView(View, LogoutMixin): """credential requestor / acceptor"""