From 37da66f18b18eea7e46433bb5d4737cf266ac414 Mon Sep 17 00:00:00 2001 From: ExostFlash <120869320+ExostFlash@users.noreply.github.com> Date: Tue, 5 Dec 2023 14:59:12 +0100 Subject: [PATCH] update --- config/packages/security.yaml | 1 + config/routes.yaml | 8 ++++++-- src/Controller/ErrorController.php | 19 +++++++++++++++++++ templates/error/access_denied.html.twig | 1 + templates/error/index.html.twig | 20 ++++++++++++++++++++ 5 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 src/Controller/ErrorController.php create mode 100644 templates/error/access_denied.html.twig create mode 100644 templates/error/index.html.twig diff --git a/config/packages/security.yaml b/config/packages/security.yaml index bf768d9..a5dc55c 100644 --- a/config/packages/security.yaml +++ b/config/packages/security.yaml @@ -21,6 +21,7 @@ security: check_path: app_user_login logout: path: app_user_logout + access_denied_url: /access-denied # activate different ways to authenticate # https://symfony.com/doc/current/security.html#the-firewall diff --git a/config/routes.yaml b/config/routes.yaml index 9286e81..7352df3 100644 --- a/config/routes.yaml +++ b/config/routes.yaml @@ -1,3 +1,7 @@ controllers: - resource: ../src/Controller/ - type: attribute + resource: ../src/Controller/ + type: attribute + +access_denied: + path: /access-denied + controller: App\Controller\ErrorController::accessDenied diff --git a/src/Controller/ErrorController.php b/src/Controller/ErrorController.php new file mode 100644 index 0000000..ad1049d --- /dev/null +++ b/src/Controller/ErrorController.php @@ -0,0 +1,19 @@ +render('error/access_denied.html.twig', []); + } +} diff --git a/templates/error/access_denied.html.twig b/templates/error/access_denied.html.twig new file mode 100644 index 0000000..6974ea9 --- /dev/null +++ b/templates/error/access_denied.html.twig @@ -0,0 +1 @@ +
src/Controller/ErrorController.phptemplates/error/index.html.twig