]> git.immae.eu Git - github/wallabag/wallabag.git/blob - src/Wallabag/CoreBundle/Controller/SecurityController.php
Merge pull request #1144 from wallabag/v2-build
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Controller / SecurityController.php
1 <?php
2
3 namespace Wallabag\CoreBundle\Controller;
4
5 use Symfony\Bundle\FrameworkBundle\Controller\Controller;
6 use Symfony\Component\HttpFoundation\Request;
7 use Symfony\Component\Security\Core\SecurityContext;
8
9 class SecurityController extends Controller
10 {
11 public function loginAction(Request $request)
12 {
13 $session = $request->getSession();
14 // get the login error if there is one
15 if ($request->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) {
16 $error = $request->attributes->get(SecurityContext::AUTHENTICATION_ERROR);
17 } else {
18 $error = $session->get(SecurityContext::AUTHENTICATION_ERROR);
19 $session->remove(SecurityContext::AUTHENTICATION_ERROR);
20 }
21
22 return $this->render('WallabagCoreBundle:Security:login.html.twig', array(
23 // last username entered by the user
24 'last_username' => $session->get(SecurityContext::LAST_USERNAME),
25 'error' => $error,
26 ));
27 }
28 }