From 1afc6a20ea7fd460fe7e828ae15089ec7ae7657d Mon Sep 17 00:00:00 2001 From: Serreau Jovann Date: Mon, 19 Jan 2026 08:38:10 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(s=C3=A9curit=C3=A9):=20Impl?= =?UTF-8?q?=C3=A9mente=20le=20verrouillage=20de=20l'intranet=20avec=20une?= =?UTF-8?q?=20page=20d'erreur=20personnalis=C3=A9e.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 1 + assets/error.js | 2 + assets/error.scss | 1 + src/Security/IntranetLocked.php | 29 +++++++++++++ templates/security/locked.twig | 74 +++++++++++++++++++++++++++++++++ vite.config.js | 1 + 6 files changed, 108 insertions(+) create mode 100644 assets/error.js create mode 100644 assets/error.scss create mode 100644 src/Security/IntranetLocked.php create mode 100644 templates/security/locked.twig diff --git a/.env b/.env index 0e1c7ae..71fa52e 100644 --- a/.env +++ b/.env @@ -96,3 +96,4 @@ ESY_SEARCH_KEY=b09d9a708b427d495c39fe6e8fc5361fe33fee57a0435f3e1bf3ed8155f2a277 ###> stripe/stripe-php ### STRIPE_SECRET_KEY=sk_test_*** ###< stripe/stripe-php ### +INTRANET_LOCK=true diff --git a/assets/error.js b/assets/error.js new file mode 100644 index 0000000..f0b6681 --- /dev/null +++ b/assets/error.js @@ -0,0 +1,2 @@ +import './error.scss' +console.log("loaded") diff --git a/assets/error.scss b/assets/error.scss new file mode 100644 index 0000000..f1d8c73 --- /dev/null +++ b/assets/error.scss @@ -0,0 +1 @@ +@import "tailwindcss"; diff --git a/src/Security/IntranetLocked.php b/src/Security/IntranetLocked.php new file mode 100644 index 0000000..813e23d --- /dev/null +++ b/src/Security/IntranetLocked.php @@ -0,0 +1,29 @@ +getRequest()->getPathInfo(),"_wdt") && + !str_contains( $requestEvent->getRequest()->getPathInfo(),"_profiler") + ) { + $response = new Response($this->environment->render('security/locked.twig')); + $response->setStatusCode(Response::HTTP_FORBIDDEN); + $requestEvent->setResponse($response); + } + + } +} diff --git a/templates/security/locked.twig b/templates/security/locked.twig new file mode 100644 index 0000000..d230947 --- /dev/null +++ b/templates/security/locked.twig @@ -0,0 +1,74 @@ + + + + + + Accès Restreint - Siteconseil + {{ vite_asset('error.js') }} + + + +
+
+
+
+ +
+
+ +
+
+ + + +
+
+ +
+

+ Accès Restreint +

+

+ L'accès à votre espace intranet est actuellement restreint. + Pour obtenir plus d'informations, veuillez contacter notre service client. +

+
+ + + +
+

+ Siteconseil © 2026 +

+
+
+
+ + + diff --git a/vite.config.js b/vite.config.js index 15fa0f5..4e6c40f 100644 --- a/vite.config.js +++ b/vite.config.js @@ -43,6 +43,7 @@ export default defineConfig({ input: { app: resolve(__dirname, 'assets/app.js'), admin: resolve(__dirname, 'assets/admin.js'), + error: resolve(__dirname, 'assets/error.js'), } }, },