src/Controller/SecurityController.php line 43

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use LogicException;
  4. use Symfony\Component\Routing\Annotation\Route;
  5. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  6. use Umbrella\AdminBundle\Service\UserManager;
  7. use Umbrella\AdminBundle\UmbrellaAdminConfiguration;
  8. use Umbrella\CoreBundle\Controller\BaseController;
  9. /**
  10.  * @Route("/admin")
  11.  */
  12. class SecurityController extends BaseController
  13. {
  14.     protected UserManager $userManager;
  15.     protected UmbrellaAdminConfiguration $config;
  16.     /**
  17.      * SecurityController constructor.
  18.      */
  19.     public function __construct(UserManager $userManagerUmbrellaAdminConfiguration $config)
  20.     {
  21.         $this->userManager $userManager;
  22.         $this->config $config;
  23.     }
  24.     /**
  25.      * @Route("/login", name="app_admin_login")
  26.      * @Route("/login", name="umbrella_admin_login")
  27.      */
  28.     public function login(AuthenticationUtils $authenticationUtils)
  29.     {
  30.         // get the login error if there is one
  31.         $error $authenticationUtils->getLastAuthenticationError();
  32.         // last username entered by the user
  33.         $lastUsername $authenticationUtils->getLastUsername();
  34.         return $this->render('Security/login.html.twig', [
  35.             'last_username' => $lastUsername,
  36.             'error' => $error,
  37.         ]);
  38.     }
  39.     /**
  40.      * @Route("/logout", name="app_admin_logout", methods={"GET"})
  41.      */
  42.     public function logout()
  43.     {
  44.         throw new LogicException();
  45.     }
  46. }