From 51c5e9ac57d756e4439742ef7edf3da3259b2f95 Mon Sep 17 00:00:00 2001 From: Constantin Simonis Date: Sat, 11 Jan 2025 18:43:57 +0100 Subject: [PATCH] refactor + homepage --- src/Controller/HomeController.php | 17 +++++++++++++++++ src/Controller/SecurityController.php | 4 ++-- templates/home/index.html.twig | 7 +++++++ 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 src/Controller/HomeController.php create mode 100644 templates/home/index.html.twig diff --git a/src/Controller/HomeController.php b/src/Controller/HomeController.php new file mode 100644 index 0000000..3702bea --- /dev/null +++ b/src/Controller/HomeController.php @@ -0,0 +1,17 @@ +render('home/index.html.twig'); + } +} diff --git a/src/Controller/SecurityController.php b/src/Controller/SecurityController.php index a1e8b27..e30e778 100644 --- a/src/Controller/SecurityController.php +++ b/src/Controller/SecurityController.php @@ -10,7 +10,7 @@ use Symfony\Component\Security\Http\Authentication\AuthenticationUtils; class SecurityController extends AbstractController { - #[Route(path: '/login', name: 'app_login')] + #[Route(path: '/login', name: 'app_login', methods: [Request::METHOD_GET, Request::METHOD_POST])] public function login(AuthenticationUtils $authenticationUtils): Response { return $this->render('security/login.html.twig', [ @@ -19,7 +19,7 @@ class SecurityController extends AbstractController ]); } - #[Route(path: '/logout', name: 'app_logout')] + #[Route(path: '/logout', name: 'app_logout', methods: Request::METHOD_GET)] public function logout(): void { throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.'); diff --git a/templates/home/index.html.twig b/templates/home/index.html.twig new file mode 100644 index 0000000..c9b5d4e --- /dev/null +++ b/templates/home/index.html.twig @@ -0,0 +1,7 @@ +{% extends 'base.html.twig' %} + +{% block title %}Home!{% endblock %} + +{% block body %} + Home +{% endblock %}