mirror of https://github.com/jumpserver/jumpserver
fix: import error
parent
08963ebb40
commit
96a0cbc35d
|
@ -1,8 +1,8 @@
|
|||
from django.db.models import TextChoices
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from authentication.confirm import CONFIRM_BACKENDS
|
||||
from .confirm import ConfirmMFA, ConfirmPassword, ConfirmReLogin
|
||||
from .mfa import MFAOtp, MFASms, MFARadius, MFAFace, MFACustom
|
||||
|
||||
RSA_PRIVATE_KEY = 'rsa_private_key'
|
||||
RSA_PUBLIC_KEY = 'rsa_public_key'
|
||||
|
@ -33,11 +33,11 @@ class ConfirmType(TextChoices):
|
|||
|
||||
|
||||
class MFAType(TextChoices):
|
||||
OTP = MFAOtp.name, MFAOtp.display_name
|
||||
SMS = MFASms.name, MFASms.display_name
|
||||
Face = MFAFace.name, MFAFace.display_name
|
||||
Radius = MFARadius.name, MFARadius.display_name
|
||||
Custom = MFACustom.name, MFACustom.display_name
|
||||
OTP = 'otp', _('OTP')
|
||||
SMS = 'sms', _('SMS')
|
||||
Face = 'face', _('Face Recognition')
|
||||
Radius = 'otp_radius', _('Radius')
|
||||
Custom = 'mfa_custom', _('Custom')
|
||||
|
||||
|
||||
FACE_CONTEXT_CACHE_KEY_PREFIX = "FACE_CONTEXT"
|
||||
|
|
|
@ -4,6 +4,7 @@ from django.utils.translation import gettext_lazy as _
|
|||
|
||||
from common.utils import get_logger
|
||||
from .base import BaseMFA
|
||||
from ..const import MFAType
|
||||
|
||||
logger = get_logger(__file__)
|
||||
|
||||
|
@ -21,8 +22,8 @@ custom_failed_msg = _("MFA Custom code invalid")
|
|||
|
||||
|
||||
class MFACustom(BaseMFA):
|
||||
name = 'mfa_custom'
|
||||
display_name = 'Custom'
|
||||
name = MFAType.Custom.value
|
||||
display_name = MFAType.Custom.name
|
||||
placeholder = _("MFA custom verification code")
|
||||
|
||||
def check_code(self, code):
|
||||
|
|
|
@ -3,11 +3,12 @@ from django.utils.translation import gettext_lazy as _
|
|||
|
||||
from authentication.mfa.base import BaseMFA
|
||||
from authentication.mixins import AuthFaceMixin
|
||||
from ..const import MFAType
|
||||
|
||||
|
||||
class MFAFace(BaseMFA, AuthFaceMixin):
|
||||
name = "face"
|
||||
display_name = _('Face Recognition')
|
||||
name = MFAType.Face.value
|
||||
display_name = MFAType.Face.name
|
||||
placeholder = 'Face Recognition'
|
||||
|
||||
def check_code(self, code):
|
||||
|
|
|
@ -2,14 +2,15 @@ from django.utils.translation import gettext_lazy as _
|
|||
from django.shortcuts import reverse
|
||||
|
||||
from .base import BaseMFA
|
||||
from ..const import MFAType
|
||||
|
||||
|
||||
otp_failed_msg = _("OTP code invalid, or server time error")
|
||||
|
||||
|
||||
class MFAOtp(BaseMFA):
|
||||
name = 'otp'
|
||||
display_name = _('OTP')
|
||||
name = MFAType.OTP.value
|
||||
display_name = MFAType.OTP.name
|
||||
placeholder = _('OTP verification code')
|
||||
|
||||
def check_code(self, code):
|
||||
|
|
|
@ -3,13 +3,14 @@ from django.utils.translation import gettext_lazy as _
|
|||
|
||||
from .base import BaseMFA
|
||||
from ..backends.radius import RadiusBackend
|
||||
from ..const import MFAType
|
||||
|
||||
mfa_failed_msg = _("Radius verify code invalid")
|
||||
|
||||
|
||||
class MFARadius(BaseMFA):
|
||||
name = 'otp_radius'
|
||||
display_name = 'Radius'
|
||||
name = MFAType.Radius.value
|
||||
display_name = MFAType.Radius.name
|
||||
placeholder = _("Radius verification code")
|
||||
|
||||
def check_code(self, code=None):
|
||||
|
|
|
@ -4,13 +4,14 @@ from django.utils.translation import gettext_lazy as _
|
|||
from common.utils.verify_code import SendAndVerifyCodeUtil
|
||||
from users.serializers import SmsUserSerializer
|
||||
from .base import BaseMFA
|
||||
from ..const import MFAType
|
||||
|
||||
sms_failed_msg = _("SMS verify code invalid")
|
||||
|
||||
|
||||
class MFASms(BaseMFA):
|
||||
name = 'sms'
|
||||
display_name = _("SMS")
|
||||
name = MFAType.SMS.value
|
||||
display_name = MFAType.SMS.name
|
||||
placeholder = _("SMS verification code")
|
||||
|
||||
def __init__(self, user):
|
||||
|
|
Loading…
Reference in New Issue