Arthur 1 год назад
Родитель
Сommit
634f35a972
2 измененных файлов с 1 добавлено и 10 удалено
  1. 1 7
      netbox/netbox/graphql/views.py
  2. 0 3
      netbox/netbox/tests/test_graphql.py

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

@@ -36,12 +36,6 @@ class NetBoxGraphQLView(GraphQLView):
 
         # Enforce LOGIN_REQUIRED
         if settings.LOGIN_REQUIRED and not request.user.is_authenticated:
-
-            # If this is a human user, send a redirect to the login page
-            # bug - todo?
-            # if self.request_wants_html(request):
-            #     return redirect_to_login(reverse('graphql'))
-
-            return HttpResponseForbidden("No credentials provided.")
+            return redirect_to_login(reverse('graphql'))
 
         return super().dispatch(request, *args, **kwargs)

+ 0 - 3
netbox/netbox/tests/test_graphql.py

@@ -15,8 +15,6 @@ class GraphQLTestCase(TestCase):
         response = self.client.get(url)
         self.assertHttpStatus(response, 404)
 
-    '''
-    BUG TODO - Re-enable
     @override_settings(LOGIN_REQUIRED=True)
     def test_graphiql_interface(self):
         """
@@ -36,4 +34,3 @@ class GraphQLTestCase(TestCase):
         response = self.client.get(url, **header)
         with disable_warnings('django.request'):
             self.assertHttpStatus(response, 302)  # Redirect to login page
-    '''