阅读背景:

@ csrf_豁免权不适用于基于通用视图的类

来源:互联网 
class ChromeLoginView(View):

     def get(self, request):
          return JsonResponse({'status': request.user.is_authenticated()})

     @method_decorator(csrf_exempt)
     def post(self, request):
          username = request.POST['username']
          password = request.POST['password']
          user = authenticate(username=username, password=password)
          if user is not None:
                if user.is_active:
                     login(request, user)
                     return JsonResponse({'status': True})
          return JsonResponse({'status': False})
class ChromeLoginView(View):

     def get(self



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: