public function loginAction(FormView $loginFormView)
{
$translator = $this->get('translator');
/**
* If user is already logged, go to redirect url
*/
$authorizationChecker = $this->get('security.authorization_checker');
if ($authorizationChecker->isGranted('ROLE_CUSTOMER')) {
return $this->redirectToRoute('store_homepage');
}
/**
* Checking for authentication errors in session
*/
$session = $this->get('session');
if ($session->has(Security::AUTHENTICATION_ERROR)) {
$message = $translator->trans('store.login.wrong_combination');
$this->addFlash('error', $message);
}
return $this->renderTemplate('Pages:user-login.html.twig', ['form' => $loginFormView]);
}