src/Controller/Admin/SecurityController.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Admin;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use Symfony\Component\HttpFoundation\Request;
  5. use Symfony\Component\Routing\Annotation\Route;
  6. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  7. class SecurityController extends AbstractController
  8. {
  9.     /**
  10.      * @Route("/admin/login", name="admin_login")
  11.      */
  12.     public function login(AuthenticationUtils $authenticationUtils)
  13.     {
  14.         // Получить ошибку входа, если она есть
  15.         $error $authenticationUtils->getLastAuthenticationError();
  16.         // Последнее введенное имя пользователя
  17.         $lastUsername $authenticationUtils->getLastUsername();
  18.         return $this->render('admin/login.html.twig', [
  19.             'last_username' => $lastUsername,
  20.             'error' => $error,
  21.         ]);
  22.     }
  23.     /**
  24.      * @Route("/admin/logout", name="admin_logout")
  25.      */
  26.     public function logout()
  27.     {
  28.         // Symfony обработает процесс выхода
  29.         throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
  30.     }
  31. }