changeset 1405:3dff555fe691

pages: do no send HTTP_FORBIDDEN when registration is not allowed and no profile is connected: if registration is not allowed, an existing user may still want to log in.
author Goffi <goffi@goffi.org>
date Fri, 16 Apr 2021 18:40:17 +0200
parents 6a35167a4e2c
children cffa3ae4d0aa
files libervia/server/pages.py
diffstat 1 files changed, 3 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libervia/server/pages.py	Fri Apr 16 18:38:45 2021 +0200
+++ b/libervia/server/pages.py	Fri Apr 16 18:40:17 2021 +0200
@@ -1668,14 +1668,9 @@
         elif self.access == C.PAGES_ACCESS_PROFILE:
             profile = self.getProfile(request)
             if not profile:
-                # no session started
-                if not self.host.options["allow_registration"]:
-                    # registration not allowed, access is not granted
-                    self.pageError(request, C.HTTP_FORBIDDEN)
-                else:
-                    # registration allowed, we redirect to login page
-                    login_url = self.getPageRedirectURL(request)
-                    self.HTTPRedirect(request, login_url)
+                # registration allowed, we redirect to login page
+                login_url = self.getPageRedirectURL(request)
+                self.HTTPRedirect(request, login_url)
 
     def setBestLocale(self, request):
         """Guess the best locale when it is not specified explicitly by user