2015-01-31 15:14:10 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Wallabag\CoreBundle\Controller;
|
|
|
|
|
|
|
|
|
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
|
|
|
|
use Symfony\Component\HttpFoundation\Request;
|
|
|
|
|
use Symfony\Component\Security\Core\SecurityContext;
|
|
|
|
|
|
|
|
|
|
class SecurityController extends Controller
|
|
|
|
|
{
|
|
|
|
|
public function loginAction(Request $request)
|
|
|
|
|
{
|
|
|
|
|
$session = $request->getSession();
|
|
|
|
|
// get the login error if there is one
|
|
|
|
|
if ($request->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) {
|
|
|
|
|
$error = $request->attributes->get(SecurityContext::AUTHENTICATION_ERROR);
|
|
|
|
|
} else {
|
|
|
|
|
$error = $session->get(SecurityContext::AUTHENTICATION_ERROR);
|
|
|
|
|
$session->remove(SecurityContext::AUTHENTICATION_ERROR);
|
|
|
|
|
}
|
2015-01-31 19:09:34 +01:00
|
|
|
|
2015-01-31 15:14:10 +01:00
|
|
|
return $this->render('WallabagCoreBundle:Security:login.html.twig', array(
|
|
|
|
|
// last username entered by the user
|
|
|
|
|
'last_username' => $session->get(SecurityContext::LAST_USERNAME),
|
|
|
|
|
'error' => $error,
|
|
|
|
|
));
|
|
|
|
|
}
|
2015-01-31 19:09:34 +01:00
|
|
|
}
|