diff --git a/geoportal/c2cgeoportal_geoportal/views/login.py b/geoportal/c2cgeoportal_geoportal/views/login.py index e49eb845bd..28de2197f6 100644 --- a/geoportal/c2cgeoportal_geoportal/views/login.py +++ b/geoportal/c2cgeoportal_geoportal/views/login.py @@ -93,6 +93,9 @@ def _referrer_log(self) -> None: @forbidden_view_config(renderer="login.html") # type: ignore[misc] 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( @@ -101,9 +104,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 {