src/Admin/Modules/User/Controller/SecurityController.php line 20

  1. <?php
  2. namespace App\Admin\Modules\User\Controller;
  3. use Symfony\Component\HttpFoundation\Request;
  4. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  5. use App\Service\CustomLayoutService;
  6. use App\Admin\Controller\BaseController;
  7. use App\Admin\Modules\User\Form\LoginType;
  8. class SecurityController extends BaseController
  9. {
  10.     private $_customLayoutService;
  11.     public function __construct(CustomLayoutService $customLayoutService)
  12.     {
  13.         $this->_customLayoutService $customLayoutService;
  14.     }
  15.     public function login(Request $requestAuthenticationUtils $authenticationUtils)
  16.     {
  17.         $error $authenticationUtils->getLastAuthenticationError();
  18.         $lastUsername $authenticationUtils->getLastUsername();
  19.         $form $this->createForm(LoginType::class);
  20.         
  21.         $targetPath $request->getSession()->get('_security.admin.target_path'$this->generateUrl('admin_index'));
  22.         return $this->render($this->_customLayoutService->getTemplatePath('login') ?? 'Admin/Modules/User/Templates/Security/login.html.twig', array(
  23.             'last_username' => $lastUsername,
  24.             'error' => $error,
  25.             'form' => $form->createView(),
  26.             'targetPath' => $targetPath
  27.         ));
  28.     }
  29. }