Completed
Push — master ( a0a31d...c5384e )
by Julito
24:45 queued 10:34
created

SecurityController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 27
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A loginJson() 0 8 1
A login() 0 8 1
1
<?php
2
3
/* For licensing terms, see /license.txt */
4
5
namespace Chamilo\CoreBundle\Controller;
6
7
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
8
use Symfony\Component\HttpFoundation\Response;
9
use Symfony\Component\Routing\Annotation\Route;
10
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
11
12
/**
13
 * Class SecurityController.
14
 */
15
class SecurityController extends AbstractController
16
{
17
    /**
18
     * @Route("/login", name="login")
19
     */
20
    public function login(AuthenticationUtils $authenticationUtils): Response
21
    {
22
        $error = $authenticationUtils->getLastAuthenticationError();
23
        $lastUsername = $authenticationUtils->getLastUsername();
24
25
        return $this->render('@ChamiloCore/Index/vue.html.twig', [
26
            'last_username' => $lastUsername,
27
            'error' => $error,
28
        ]);
29
    }
30
31
    /**
32
     * @Route("/login_json", name="login_json")
33
     */
34
    public function loginJson(AuthenticationUtils $authenticationUtils): Response
35
    {
36
        $error = $authenticationUtils->getLastAuthenticationError();
37
        $lastUsername = $authenticationUtils->getLastUsername();
38
39
        return $this->render('@ChamiloCore/login.html.twig', [
40
            'last_username' => $lastUsername,
41
            'error' => $error,
42
        ]);
43
    }
44
}
45