use a LogoutMixin
This commit is contained in:
parent
a0b1a095e4
commit
e1549dd6ff
1 changed files with 10 additions and 5 deletions
|
@ -31,10 +31,8 @@ from . import utils
|
||||||
from . import forms
|
from . import forms
|
||||||
from . import models
|
from . import models
|
||||||
|
|
||||||
class LogoutView(View):
|
class LogoutMixin(object):
|
||||||
"""destroy CAS session (logout) view"""
|
"""destroy CAS session utims"""
|
||||||
request = None
|
|
||||||
service = None
|
|
||||||
def clean_session_variables(self):
|
def clean_session_variables(self):
|
||||||
"""Clean sessions variables"""
|
"""Clean sessions variables"""
|
||||||
try:
|
try:
|
||||||
|
@ -61,6 +59,12 @@ class LogoutView(View):
|
||||||
finally:
|
finally:
|
||||||
self.clean_session_variables()
|
self.clean_session_variables()
|
||||||
|
|
||||||
|
class LogoutView(View, LogoutMixin):
|
||||||
|
"""destroy CAS session (logout) view"""
|
||||||
|
|
||||||
|
request = None
|
||||||
|
service = None
|
||||||
|
|
||||||
def get(self, request, *args, **kwargs):
|
def get(self, request, *args, **kwargs):
|
||||||
"""methode called on GET request on this view"""
|
"""methode called on GET request on this view"""
|
||||||
self.request = request
|
self.request = request
|
||||||
|
@ -75,7 +79,7 @@ class LogoutView(View):
|
||||||
messages.add_message(request, messages.SUCCESS, _(u'Successfully logout'))
|
messages.add_message(request, messages.SUCCESS, _(u'Successfully logout'))
|
||||||
return redirect("cas_server:login")
|
return redirect("cas_server:login")
|
||||||
|
|
||||||
class LoginView(View, LogoutView):
|
class LoginView(View, LogoutMixin):
|
||||||
"""credential requestor / acceptor"""
|
"""credential requestor / acceptor"""
|
||||||
|
|
||||||
# pylint: disable=too-many-instance-attributes
|
# pylint: disable=too-many-instance-attributes
|
||||||
|
@ -123,6 +127,7 @@ class LoginView(View, LogoutView):
|
||||||
return self.common()
|
return self.common()
|
||||||
|
|
||||||
def get(self, request, *args, **kwargs):
|
def get(self, request, *args, **kwargs):
|
||||||
|
"""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.renew = True if request.GET.get('renew') else False
|
self.renew = True if request.GET.get('renew') else False
|
||||||
|
|
Loading…
Reference in a new issue