diff --git a/config/routes.yaml b/config/routes.yaml index 921a7c6..7c8c0a1 100644 --- a/config/routes.yaml +++ b/config/routes.yaml @@ -6,9 +6,17 @@ # path: / # controller: App\Controller\SecurityController::login -hometown: +#homepage: + #path: / + #controller: App\Controller\SecurityController::login + +home: path: / - controller: App\Controller\SecurityController::login + controller: App\Controller\SecurityController::sitemap + +sitemap: + path: /sitemap + controller: App\Controller\SecurityController::sitemap post_ledger: path: /post diff --git a/public/assets/css/style.css b/public/assets/css/style.css index ca40aa0..43c55b2 100644 --- a/public/assets/css/style.css +++ b/public/assets/css/style.css @@ -38,5 +38,5 @@ nav { #login-container { margin-left: 25%; - margin-top: 15%; + margin-top: 5%; } diff --git a/src/Controller/SecurityController.php b/src/Controller/SecurityController.php index b32a784..01a8042 100644 --- a/src/Controller/SecurityController.php +++ b/src/Controller/SecurityController.php @@ -14,12 +14,10 @@ class SecurityController extends AbstractController */ public function login(AuthenticationUtils $authenticationUtils): Response { - // if ($this->getUser()) { - // return $this->redirectToRoute('target_path'); - // } // get the login error if there is one $error = $authenticationUtils->getLastAuthenticationError(); + // last username entered by the user $lastUsername = $authenticationUtils->getLastUsername(); @@ -34,4 +32,9 @@ public function logout() return $this->redirectToRoute('app_login'); throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.'); } + + public function sitemap() + { + return $this->render('sitemap.html.twig'); + } } diff --git a/src/Controller/UserController.php b/src/Controller/UserController.php index 8d59f6f..a04944b 100644 --- a/src/Controller/UserController.php +++ b/src/Controller/UserController.php @@ -137,6 +137,8 @@ public function delete(Request $request, User $user): Response $entityManager = $this->getDoctrine()->getManager(); $entityManager->remove($user); $entityManager->flush(); + + $this->_delete_yourself(); } } return $this->redirectToRoute('user_index'); @@ -144,4 +146,10 @@ public function delete(Request $request, User $user): Response return $this->redirectToRoute('app_login'); } } + + private function _delete_yourself(){ + // if you delete yourself, automatically, destroy session and logout + session_destroy(); + return $this->redirectToRoute('app_login'); + } } diff --git a/src/Form/PostType.php b/src/Form/PostType.php index efa5fb4..d673490 100644 --- a/src/Form/PostType.php +++ b/src/Form/PostType.php @@ -16,7 +16,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) $builder ->add('title', TextType::class, ['attr' => ['class' => 'form-control', 'maxlength' => 32]]) ->add('body', TextAreaType::class, - ['attr' => ['class' => 'form-control', 'cols' => 4, 'maxlength' =>255]] + ['attr' => ['class' => 'form-control', 'cols' => 5, 'maxlength' =>255]] ); } diff --git a/templates/base.html.twig b/templates/base.html.twig index 0ca448d..7be3e92 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -74,6 +74,10 @@ Posts
There are no posts submitted.