switch loginController to symfony3

This commit is contained in:
Julien Fastré 2018-04-19 20:03:10 +02:00
parent 06bff38701
commit 2bcaaac60c

View File

@ -17,29 +17,12 @@ class LoginController extends Controller
*/
public function loginAction(Request $request)
{
$session = $request->getSession();
if ($request->attributes->has(SecurityContextInterface::AUTHENTICATION_ERROR)) {
$error = $request->attributes->get(
SecurityContextInterface::AUTHENTICATION_ERROR
);
} elseif (null !== $session && $session->has(SecurityContextInterface::AUTHENTICATION_ERROR)) {
$error = $session->get(SecurityContextInterface::AUTHENTICATION_ERROR);
$session->remove(SecurityContextInterface::AUTHENTICATION_ERROR);
} else {
$error = '';
}
$lastUsername = (null === $session) ?
'' : $session->get(SecurityContextInterface::LAST_USERNAME);
$helper = $this->get('security.authentication_utils');
return $this->render('ChillMainBundle:Login:login.html.twig', array(
'last_username' => $lastUsername,
'error' => (empty($error)) ? $error : $error->getMessage()
'last_username' => $helper->getLastUsername(),
'error' => $helper->getLastAuthenticationError()
));
}
public function LoginCheckAction(Request $request)