[Update] MFA

pull/3428/head
ibuler 5 years ago
parent 8de863525a
commit 6fbc4ce4fb

@ -30,9 +30,10 @@ class MFAChallengeApi(AuthMixin, CreateAPIView):
raise errors.MFAFailedError(
username=user.username, request=self.request
)
else:
self.request.session['auth_mfa'] = '1'
except errors.AuthFailedError as e:
data = {"error": e.error, "msg": e.reason}
data = {"error": e.error, "msg": e.msg}
raise ValidationError(data)
def create(self, request, *args, **kwargs):

@ -128,12 +128,12 @@ class BlockLoginError(AuthFailedNeedBlockMixin, AuthFailedError):
class SessionEmptyError(AuthFailedError):
msg = session_empty_msg
error = 'session_empty_msg'
error = 'session_empty'
class MFARequiredError(AuthFailedError):
msg = mfa_required_msg
error = 'mfa_required_msg'
error = 'mfa_required'
def as_data(self):
return {
@ -146,12 +146,12 @@ class MFARequiredError(AuthFailedError):
class LoginConfirmRequiredError(AuthFailedError):
msg = login_confirm_required_msg
error = 'login_confirm_required_msg'
error = 'login_confirm_required'
class LoginConfirmError(AuthFailedError):
msg = login_confirm_wait_msg
error = 'login_confirm_wait_msg'
error = 'login_confirm_wait'
def __init__(self, order_id, **kwargs):
self.order_id = order_id
@ -167,14 +167,14 @@ class LoginConfirmError(AuthFailedError):
class LoginConfirmWaitError(LoginConfirmError):
msg = login_confirm_wait_msg
error = 'login_confirm_wait_msg'
error = 'login_confirm_wait'
class LoginConfirmRejectedError(LoginConfirmError):
msg = login_confirm_rejected_msg
error = 'login_confirm_rejected_msg'
error = 'login_confirm_rejected'
class LoginConfirmOrderNotFound(LoginConfirmError):
msg = login_confirm_order_not_found_msg
error = 'login_confirm_order_not_found_msg'
error = 'login_confirm_order_not_found'

@ -60,7 +60,7 @@ class BearerTokenSerializer(serializers.Serializer):
class MFAChallengeSerializer(serializers.Serializer):
auth_type = serializers.CharField(write_only=True, required=False, allow_blank=True)
type = serializers.CharField(write_only=True, required=False, allow_blank=True)
code = serializers.CharField(write_only=True)
def create(self, validated_data):

Loading…
Cancel
Save