mirror of
https://github.com/jumpserver/jumpserver.git
synced 2026-03-19 19:42:07 +00:00
* perf: remove call client old- method via ?next=client * feat: add 2 decorators for login-get and login-callback-get to set next_page and get next_page from session * perf: code style * perf: handling the next parameter propagation issue in third-party authentication flows * perf: request.GET.dict() to copy() * perf: style import --------- Co-authored-by: Bai <baijiangjie@gmail.com>
23 lines
737 B
Python
23 lines
737 B
Python
from django.core.exceptions import PermissionDenied
|
|
from django.http import HttpResponseRedirect
|
|
from django.utils.translation import gettext_lazy as _
|
|
from django_cas_ng.views import LoginView
|
|
|
|
from authentication.views.mixins import FlashMessageMixin
|
|
|
|
__all__ = ['LoginView']
|
|
|
|
|
|
class CASLoginView(LoginView, FlashMessageMixin):
|
|
def get(self, request):
|
|
try:
|
|
resp = super().get(request)
|
|
except PermissionDenied:
|
|
resp = HttpResponseRedirect('/')
|
|
error_message = getattr(request, 'error_message', '')
|
|
if error_message:
|
|
response = self.get_failed_response('/', title=_('CAS Error'), msg=error_message)
|
|
return response
|
|
else:
|
|
return resp
|