def post(self, request): serializer = AuthRequestSerializer(data=request.DATA) if serializer.is_valid(): user = serializer.object['user'] if not user.is_active: return Response('Account is not active', HTTP_423_LOCKED) auth.login(request, user) response = token_in_data(request, user) return Response(response) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
def post(self, request): serializer = AuthRequestSerializer(data=request.DATA) if serializer.is_valid(): user = serializer.object['user'] if not user.is_active: return Response('Account is not active', HTTP_423_LOCKED) auth.login(request, user) user_serializer = AuthUserSerializer(instance=user) csrf.get_token(request) return Response(user_serializer.data) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)