diff libervia/server/pages.py @ 1173:0f37b65fe7c2

server: replaced wrong usage of C.HTTP_UNAUTHORIZED by C.HTTP_FORBIDDEN
author Goffi <goffi@goffi.org>
date Fri, 03 May 2019 20:51:22 +0200
parents 469d0de8da0e
children ab858db9dbee
line wrap: on
line diff
--- a/libervia/server/pages.py	Fri May 03 13:08:41 2019 +0200
+++ b/libervia/server/pages.py	Fri May 03 20:51:22 2019 +0200
@@ -1304,7 +1304,7 @@
                     url=request.uri, ip=request.getClientIP()
                 )
             )
-            self.pageError(request, C.HTTP_UNAUTHORIZED)
+            self.pageError(request, C.HTTP_FORBIDDEN)
         d = defer.maybeDeferred(self.on_data_post, self, request)
         d.addCallback(self._on_data_post_redirect, request)
         return d
@@ -1390,7 +1390,7 @@
     def _checkAccess(self, data, request):
         """Check access according to self.access
 
-        if access is not granted, show a HTTP_UNAUTHORIZED pageError and stop request,
+        if access is not granted, show a HTTP_FORBIDDEN pageError and stop request,
         else return data (so it can be inserted in deferred chain
         """
         if self.access == C.PAGES_ACCESS_PUBLIC:
@@ -1401,7 +1401,7 @@
                 # no session started
                 if not self.host.options["allow_registration"]:
                     # registration not allowed, access is not granted
-                    self.pageError(request, C.HTTP_UNAUTHORIZED)
+                    self.pageError(request, C.HTTP_FORBIDDEN)
                 else:
                     # registration allowed, we redirect to login page
                     login_url = self.getPageRedirectURL(request)