diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-01-31 15:14:10 +0100 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-01-31 15:14:10 +0100 |
commit | c3235553ddc2bb5965f6fe00e750cfe4aac9ccdf (patch) | |
tree | 271305a039d31059c7af8be220da08b9331baeec /src/Wallabag/CoreBundle/Controller/SecurityController.php | |
parent | 71691fe44a7b2a80f3b9d96d54720cce7994ad08 (diff) | |
download | wallabag-c3235553ddc2bb5965f6fe00e750cfe4aac9ccdf.tar.gz wallabag-c3235553ddc2bb5965f6fe00e750cfe4aac9ccdf.tar.zst wallabag-c3235553ddc2bb5965f6fe00e750cfe4aac9ccdf.zip |
first implementation of security
Diffstat (limited to 'src/Wallabag/CoreBundle/Controller/SecurityController.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Controller/SecurityController.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/SecurityController.php b/src/Wallabag/CoreBundle/Controller/SecurityController.php new file mode 100644 index 00000000..51f9cc26 --- /dev/null +++ b/src/Wallabag/CoreBundle/Controller/SecurityController.php | |||
@@ -0,0 +1,27 @@ | |||
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 | return $this->render('WallabagCoreBundle:Security:login.html.twig', array( | ||
22 | // last username entered by the user | ||
23 | 'last_username' => $session->get(SecurityContext::LAST_USERNAME), | ||
24 | 'error' => $error, | ||
25 | )); | ||
26 | } | ||
27 | } \ No newline at end of file | ||