예제 #1
0
    def post(self, request, *args, **kwargs):
        super().post(request, *args, **kwargs)

        return Response(
            serializers.UserMFAMethodSerializer(
                request.user.mfa_methods.filter(is_active=True),
                many=True,
            ).data,
            status=status.HTTP_200_OK,
        )
예제 #2
0
 def handle_mfa_response(self, user, mfa_method, *args, **kwargs):
     data = {
         'ephemeral_token':
         user_token_generator.make_token(user),
         'method':
         mfa_method.name,
         'other_methods':
         serializers.UserMFAMethodSerializer(
             user.mfa_methods.filter(is_active=True, is_primary=False),
             many=True,
         ).data,
     }
     return Response(data)
예제 #3
0
 def get(self, request, *args, **kwargs):
     active_mfa_methods = MFAMethod.objects.filter(user=request.user,
                                                   is_active=True)
     serializer = serializers.UserMFAMethodSerializer(active_mfa_methods,
                                                      many=True)
     return Response(serializer.data)