<?php
namespace App\Controller\Admin;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
class SecurityController extends AbstractController
{
/**
* @Route("/admin/login", name="admin_login")
*/
public function login(AuthenticationUtils $authenticationUtils)
{
// Получить ошибку входа, если она есть
$error = $authenticationUtils->getLastAuthenticationError();
// Последнее введенное имя пользователя
$lastUsername = $authenticationUtils->getLastUsername();
return $this->render('admin/login.html.twig', [
'last_username' => $lastUsername,
'error' => $error,
]);
}
/**
* @Route("/admin/logout", name="admin_logout")
*/
public function logout()
{
// Symfony обработает процесс выхода
throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
}
}