Arthur пре 2 година
родитељ
комит
151717545a
2 измењених фајлова са 4 додато и 2 уклоњено
  1. 2 1
      netbox/netbox/graphql/views.py
  2. 2 1
      netbox/netbox/tests/test_graphql.py

+ 2 - 1
netbox/netbox/graphql/views.py

@@ -36,6 +36,7 @@ class NetBoxGraphQLView(GraphQLView):
 
         # Enforce LOGIN_REQUIRED
         if settings.LOGIN_REQUIRED and not request.user.is_authenticated:
-            return redirect_to_login(reverse('graphql'))
+            # return redirect_to_login(reverse('graphql'))
+            return HttpResponseForbidden("No credentials provided.")
 
         return super().dispatch(request, *args, **kwargs)

+ 2 - 1
netbox/netbox/tests/test_graphql.py

@@ -33,4 +33,5 @@ class GraphQLTestCase(TestCase):
         self.client.logout()
         response = self.client.get(url, **header)
         with disable_warnings('django.request'):
-            self.assertHttpStatus(response, 302)  # Redirect to login page
+            # self.assertHttpStatus(response, 302)  # Redirect to login page
+            self.assertHttpStatus(response, 403)  # Redirect to login page