From 8084ce25067d068e176c06d5714d59c2df218091 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Wed, 18 Dec 2024 17:18:44 +0100 Subject: [PATCH] Don't have an authenticatication loop When we want to access to the admin interface with oidc and with a user that's not allowed to access to the admin interface. --- geoportal/c2cgeoportal_geoportal/views/login.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/geoportal/c2cgeoportal_geoportal/views/login.py b/geoportal/c2cgeoportal_geoportal/views/login.py index 2d812a3c94..93c729e187 100644 --- a/geoportal/c2cgeoportal_geoportal/views/login.py +++ b/geoportal/c2cgeoportal_geoportal/views/login.py @@ -92,6 +92,9 @@ def _referrer_log(self) -> None: @forbidden_view_config(renderer="login.html") # type: ignore def loginform403(self) -> dict[str, Any] | pyramid.response.Response: + if self.request.authenticated_userid is not None: + return HTTPForbidden() + if self.authentication_settings.get("openid_connect", {}).get("enabled", False): return HTTPFound( location=self.request.route_url( @@ -100,9 +103,6 @@ def loginform403(self) -> dict[str, Any] | pyramid.response.Response: ) ) - if self.request.authenticated_userid is not None: - return HTTPForbidden() - set_common_headers(self.request, "login", Cache.PRIVATE_NO) return {