mirror of https://github.com/jumpserver/jumpserver
fix: 修复用户登录认证 MFA 输入错误时没有记录具体错误信息的问题
parent
04175a4c1a
commit
ae47003d2c
|
@ -1,5 +1,6 @@
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.module_loading import import_string
|
from django.utils.module_loading import import_string
|
||||||
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from common.utils import get_logger
|
from common.utils import get_logger
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
from authentication.signals import user_auth_failed, user_auth_success
|
from authentication.signals import user_auth_failed, user_auth_success
|
||||||
|
|
|
@ -89,8 +89,6 @@ class MFAFailedError(AuthFailedNeedLogMixin, AuthFailedError):
|
||||||
msg: str
|
msg: str
|
||||||
|
|
||||||
def __init__(self, username, request, ip, mfa_type, error):
|
def __init__(self, username, request, ip, mfa_type, error):
|
||||||
super().__init__(username=username, request=request)
|
|
||||||
|
|
||||||
util = MFABlockUtils(username, ip)
|
util = MFABlockUtils(username, ip)
|
||||||
times_remainder = util.incr_failed_count()
|
times_remainder = util.incr_failed_count()
|
||||||
block_time = settings.SECURITY_LOGIN_LIMIT_TIME
|
block_time = settings.SECURITY_LOGIN_LIMIT_TIME
|
||||||
|
@ -101,6 +99,7 @@ class MFAFailedError(AuthFailedNeedLogMixin, AuthFailedError):
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
self.msg = const.block_mfa_msg.format(settings.SECURITY_LOGIN_LIMIT_TIME)
|
self.msg = const.block_mfa_msg.format(settings.SECURITY_LOGIN_LIMIT_TIME)
|
||||||
|
super().__init__(username=username, request=request)
|
||||||
|
|
||||||
|
|
||||||
class BlockMFAError(AuthFailedNeedLogMixin, AuthFailedError):
|
class BlockMFAError(AuthFailedNeedLogMixin, AuthFailedError):
|
||||||
|
|
Loading…
Reference in New Issue