src/Controller/SecurityController.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use Symfony\Component\Routing\Annotation\Route;
  5. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  6. class SecurityController extends AbstractController
  7. {
  8.     /**
  9.      * @Route("/login", name="user_login")
  10.      */
  11.     public function login(AuthenticationUtils $authenticationUtils)
  12.     {
  13.         // get the login error if there is one
  14.         $error $authenticationUtils->getLastAuthenticationError();
  15.         // last username entered by the user
  16.         $lastUsername $authenticationUtils->getLastUsername();
  17.         return $this->render('login.html.twig', [
  18.             'last_username' => $lastUsername,
  19.             'error' => $error
  20.         ]);
  21.     }
  22.     /**
  23.      * @Route("/logout", name="user_logout")
  24.      */
  25.     public function logout()
  26.     {
  27.         throw new \Exception('SecurityController Exeption: logout failure.');
  28.     }
  29. }