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

SecurityController   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 31
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A login() 0 17 2
A logout() 0 4 1
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