<?php
namespace App\Controller;
use LogicException;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
use Umbrella\AdminBundle\Service\UserManager;
use Umbrella\AdminBundle\UmbrellaAdminConfiguration;
use Umbrella\CoreBundle\Controller\BaseController;
/**
* @Route("/admin")
*/
class SecurityController extends BaseController
{
protected UserManager $userManager;
protected UmbrellaAdminConfiguration $config;
/**
* SecurityController constructor.
*/
public function __construct(UserManager $userManager, UmbrellaAdminConfiguration $config)
{
$this->userManager = $userManager;
$this->config = $config;
}
/**
* @Route("/login", name="app_admin_login")
* @Route("/login", name="umbrella_admin_login")
*/
public function login(AuthenticationUtils $authenticationUtils)
{
// get the login error if there is one
$error = $authenticationUtils->getLastAuthenticationError();
// last username entered by the user
$lastUsername = $authenticationUtils->getLastUsername();
return $this->render('Security/login.html.twig', [
'last_username' => $lastUsername,
'error' => $error,
]);
}
/**
* @Route("/logout", name="app_admin_logout", methods={"GET"})
*/
public function logout()
{
throw new LogicException();
}
}