src/Controller/SecurityController.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use Symfony\Component\HttpFoundation\Response;
  4. use Symfony\Component\Routing\Annotation\Route;
  5. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  6. class SecurityController extends BaseController
  7. {
  8.     /**
  9.      * @Route("/connexion", name="app_login")
  10.      */
  11.     public function login(AuthenticationUtils $authenticationUtils): Response
  12.     {
  13.         if ($this->getUser()) {
  14.             return $this->redirectToRoute('account_dashboard');
  15.         }
  16.         // get the login error if there is one
  17.         $error $authenticationUtils->getLastAuthenticationError();
  18.         // last username entered by the user
  19.         $lastUsername $authenticationUtils->getLastUsername();
  20.         $seo = [
  21.             'title' => 'Emys Sodiclair',
  22.             'description' => '',
  23.             'keywords' => ''
  24.         ];
  25.         return $this->generateTemplate('connexion', [
  26.             'seo' => $seo,
  27.             'last_username' => $lastUsername,
  28.             'error' => $error
  29.         ]);
  30.     }
  31.     /**
  32.      * @Route("/logout", name="app_logout")
  33.      */
  34.     public function logout()
  35.     {
  36.         throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
  37.     }
  38. }