Completed
Push — master ( e1e474...93960f )
by Cesar
12s queued 10s
created

SecurityController::logout()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace App\Controller;
4
5
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
6
use Symfony\Component\HttpFoundation\Response;
7
use Symfony\Component\Routing\Annotation\Route;
8
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
9
10
/**
11
 * Class SecurityController
12
 * @package App\Controller
13
 */
14
class SecurityController extends AbstractController
15
{
16
    /**
17
     * @Route("/login", name="app_login")
18
     */
19
    public function login(AuthenticationUtils $authenticationUtils): Response
20
    {
21
        if ($this->getUser()) {
22
            return $this->redirectToRoute('index');
23
        }
24
25
        $error = $authenticationUtils->getLastAuthenticationError();
26
        $lastUsername = $authenticationUtils->getLastUsername();
27
28
        return $this->render('security/login.html.twig',
29
            [
30
                'last_username' => $lastUsername,
31
                'error' => $error,
32
                'GOOGLE_RECAPTCHA_SITE_KEY'
33
            ]
34
        );
35
    }
36
37
    /**
38
     * @Route("/logout", name="app_logout")
39
     */
40
    public function logout()
41
    {
42
        throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
43
    }
44
}
45