src/Controller/FielpetPol/SecurityController.php line 25

Open in your IDE?
  1. <?php
  2. namespace App\Controller\FielpetPol;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use Symfony\Component\HttpFoundation\Response;
  5. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  6. use Symfony\Component\Routing\Annotation\Route;
  7. class SecurityController extends AbstractController
  8. {
  9. /**
  10. * @Route("/", name="anon_index")
  11. */
  12. public function homepageAction()
  13. {
  14. return $this->redirectToRoute('app_fielpet_vetform_view_index');
  15. }
  16. /**
  17. * @Route("/login", name="app_login")
  18. */
  19. public function loginAction(AuthenticationUtils $authenticationUtils): Response
  20. {
  21. // get the login error if there is one
  22. $error = $authenticationUtils->getLastAuthenticationError();
  23. // last username entered by the user
  24. $lastUsername = $authenticationUtils->getLastUsername();
  25. return $this -> render(
  26. 'security/login.html.twig', array(
  27. 'last_username' => $lastUsername,
  28. 'error' => $error));
  29. }
  30. /**
  31. * @Route("/logout", name="app_logout")
  32. */
  33. public function logout(): void
  34. {
  35. throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
  36. }
  37. /**
  38. * @Route("/protected", name="honos_protected_index")
  39. */
  40. public function protectedAction()
  41. {
  42. //Needed only while not migrating homepage, after that remove
  43. return $this->redirectToRoute('app_fielpet_vetform_view_index');
  44. }
  45. }