mirror of https://github.com/jumpserver/jumpserver
[Update] 修改报错文案
parent
61407331bc
commit
91c994924f
|
@ -93,6 +93,9 @@ class AuthFailedError(Exception):
|
||||||
'msg': self.msg,
|
'msg': self.msg,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return str(self.msg)
|
||||||
|
|
||||||
|
|
||||||
class CredentialError(AuthFailedNeedLogMixin, AuthFailedNeedBlockMixin, AuthFailedError):
|
class CredentialError(AuthFailedNeedLogMixin, AuthFailedNeedBlockMixin, AuthFailedError):
|
||||||
def __init__(self, error, username, ip, request):
|
def __init__(self, error, username, ip, request):
|
||||||
|
|
|
@ -6,6 +6,9 @@ from django.views.generic.edit import FormView
|
||||||
from .. import forms, errors, mixins
|
from .. import forms, errors, mixins
|
||||||
from .utils import redirect_to_guard_view
|
from .utils import redirect_to_guard_view
|
||||||
|
|
||||||
|
from common.utils import get_logger
|
||||||
|
|
||||||
|
logger = get_logger(__name__)
|
||||||
__all__ = ['UserLoginOtpView']
|
__all__ = ['UserLoginOtpView']
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,6 +25,7 @@ class UserLoginOtpView(mixins.AuthMixin, FormView):
|
||||||
except errors.MFAFailedError as e:
|
except errors.MFAFailedError as e:
|
||||||
form.add_error('otp_code', e.msg)
|
form.add_error('otp_code', e.msg)
|
||||||
return super().form_invalid(form)
|
return super().form_invalid(form)
|
||||||
except:
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
return redirect_to_guard_view()
|
return redirect_to_guard_view()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue