2022-08-16 09:24:58 +00:00
|
|
|
from django.core.exceptions import PermissionDenied
|
|
|
|
from django.http import HttpResponseRedirect
|
2024-12-18 09:25:40 +00:00
|
|
|
from django.views.generic import View
|
|
|
|
from django_cas_ng.views import LoginView
|
2022-08-16 09:24:58 +00:00
|
|
|
|
|
|
|
__all__ = ['LoginView']
|
|
|
|
|
2024-12-18 09:25:40 +00:00
|
|
|
from authentication.views.utils import redirect_to_guard_view
|
|
|
|
|
2022-08-16 09:24:58 +00:00
|
|
|
|
|
|
|
class CASLoginView(LoginView):
|
|
|
|
def get(self, request):
|
|
|
|
try:
|
|
|
|
return super().get(request)
|
|
|
|
except PermissionDenied:
|
|
|
|
return HttpResponseRedirect('/')
|
|
|
|
|
|
|
|
|
2024-12-18 09:25:40 +00:00
|
|
|
class CASCallbackClientView(View):
|
|
|
|
http_method_names = ['get', ]
|
|
|
|
|
|
|
|
def get(self, request):
|
|
|
|
return redirect_to_guard_view(query_string='next=client')
|