mirror of
https://github.com/jumpserver/jumpserver.git
synced 2026-07-11 00:56:59 +00:00
fix: CAS login infinite loop when user is disabled
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
from django.contrib.auth import logout as auth_logout
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.urls import reverse
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django_cas_ng.views import LoginView
|
||||
|
||||
@@ -16,7 +18,11 @@ class CASLoginView(LoginView, FlashMessageMixin):
|
||||
resp = HttpResponseRedirect('/')
|
||||
error_message = getattr(request, 'error_message', '')
|
||||
if error_message:
|
||||
response = self.get_failed_response('/', title=_('CAS Error'), msg=error_message)
|
||||
auth_logout(request)
|
||||
redirect_url = reverse('authentication:login') + '?admin=1'
|
||||
response = self.get_failed_response(
|
||||
redirect_url, title=_('CAS Error'), msg=error_message
|
||||
)
|
||||
return response
|
||||
else:
|
||||
return resp
|
||||
|
||||
Reference in New Issue
Block a user