vendor/ibexa/core/src/lib/MVC/Symfony/Controller/SecurityController.php line 32

Open in your IDE?
  1. <?php
  2. /**
  3. * @copyright Copyright (C) Ibexa AS. All rights reserved.
  4. * @license For full copyright and license information view LICENSE file distributed with this source code.
  5. */
  6. namespace Ibexa\Core\MVC\Symfony\Controller;
  7. use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface;
  8. use Ibexa\Core\MVC\Symfony\View\LoginFormView;
  9. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  10. use Twig\Environment;
  11. class SecurityController
  12. {
  13. /** @var \Twig\Environment */
  14. protected $templateEngine;
  15. /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */
  16. protected $configResolver;
  17. /** @var \Symfony\Component\Security\Http\Authentication\AuthenticationUtils */
  18. protected $authenticationUtils;
  19. public function __construct(Environment $templateEngine, ConfigResolverInterface $configResolver, AuthenticationUtils $authenticationUtils)
  20. {
  21. $this->templateEngine = $templateEngine;
  22. $this->configResolver = $configResolver;
  23. $this->authenticationUtils = $authenticationUtils;
  24. }
  25. public function loginAction()
  26. {
  27. $view = new LoginFormView($this->configResolver->getParameter('security.login_template'));
  28. $view->setLastUsername($this->authenticationUtils->getLastUsername());
  29. $view->setLastAuthenticationError($this->authenticationUtils->getLastAuthenticationError());
  30. $view->addParameters([
  31. 'layout' => $this->configResolver->getParameter('security.base_layout'),
  32. ]);
  33. return $view;
  34. }
  35. }
  36. class_alias(SecurityController::class, 'eZ\Publish\Core\MVC\Symfony\Controller\SecurityController');