Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Django 密码重置确认,敏感post参数无效';我没有收到HttpRequest_Django_Django Rest Framework_Django Authentication - Fatal编程技术网

Django 密码重置确认,敏感post参数无效';我没有收到HttpRequest

Django 密码重置确认,敏感post参数无效';我没有收到HttpRequest,django,django-rest-framework,django-authentication,Django,Django Rest Framework,Django Authentication,我正在用DRF编码密码重置功能 所有操作都正常,但我发现以下错误: Django Version: 1.8.3 Exception Type: AssertionError Exception Value: sensitive_post_parameters didn't receive an HttpRequest. If you are decorating a classmethod, be sure to use @method_decorator. 这是启动错误的代码: cl

我正在用
DRF
编码密码重置功能

所有操作都正常,但我发现以下错误:

Django Version: 1.8.3
Exception Type: AssertionError
Exception Value:    
sensitive_post_parameters didn't receive an HttpRequest. If you are decorating a classmethod, be sure to use @method_decorator.
这是启动错误的代码:

class RecoveryPasswordConfirm(APIView):
    """
    API endpoint for recovery password
    """
    serializer_class = UpdatePasswordUserSelializer
    permission_classes = (AllowAny, )

    def post(self, request, uidb64=None, token=None):
        response = password_reset_confirm(
            request,
            template_name='',
            uidb64=uidb64,
            token=token,
            post_reset_redirect=reverse('password_reset_done'))

        return Response({}, status=status.HTTP_200_OK)
我不知道我还应该做什么


谢谢。

我看不出在您的代码中使用了
敏感的\u post\u参数
,它应该在
密码重置\u确认
中的某个地方

最可能的问题是因为DRF使用它自己的请求类,该类封装了django所期望的原始HttpRequest。 看


尝试使用
request.\u request
传递原始django请求

response = password_reset_confirm(
    request._request,

您是否记得将
url.py
中的视图设置为
RecoveryPasswordConfirm.as\u view()
?@KevinBrown是的,当使用post请求调用
RecoveryPasswordConfirm
时捕获它,但是
password\u reset\u confirm
返回错误
request.\u request
有效,谢谢。来得正是时候!,再次感谢