<?php
namespace Umimeweby\UWLoginUserBundle\Controller\UserLoginForm;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
use Umimeweby\UWLoginUserBundle\Contracts\Service\Security\LoginViewProviderInterface;
class LoginFormController extends AbstractController
{
private $authUtils;
private $loginViewProvider;
public function __construct(
AuthenticationUtils $authUtils,
LoginViewProviderInterface $loginViewProvider
) {
$this->authUtils = $authUtils;
$this->loginViewProvider = $loginViewProvider;
}
public function formlogin()
{
// get the login error if there is one
$error = $this->authUtils->getLastAuthenticationError();
// last username entered by the user
$lastUsername = $this->authUtils->getLastUsername();
$templatePath = $this->loginViewProvider->getLoginPageViewTemplatePath();
return $this->render($templatePath, [
'error' => $error,
'last_username' => $lastUsername,
]);
}
public function logout()
{
throw new \Exception('this should not be reached!');
}
public function loginCheckAction()
{
throw new \Exception('this should not be reached!');
}
}