public function loginAction()
{
// get the error if any (works with forward and redirect -- see below)
if ($this->container->get('request')->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) {
$error = $this->container->get('request')->attributes->get(SecurityContext::AUTHENTICATION_ERROR);
} else {
$error = $this->container->get('request')->getSession()->get(SecurityContext::AUTHENTICATION_ERROR);
$this->container->get('request')->getSession()->remove(SecurityContext::AUTHENTICATION_ERROR);
}
if ($error) {
// TODO: this is a potential security risk (see http://trac.symfony-project.org/ticket/9523)
$error = $error->getMessage();
}
return $this->container->get('templating')->renderResponse('FOSUserBundle:Security:login.html.' . $this->getEngine(), array('last_username' => $this->container->get('request')->getSession()->get(SecurityContext::LAST_USERNAME), 'error' => $error));
}