Completed
Pull Request — master (#30)
by nonanerz
04:41
created

DefaultController::indexAction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace AppBundle\Controller;
4
5
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
6
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
7
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
8
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
9
10
class DefaultController extends Controller
11
{
12
    /**
13
     * @Route("/", name="homepage")
14
     * @Template("@App/dashboard.html.twig")
15
     */
16
    public function indexAction()
17
    {
18
        return [];
19
    }
20
21
    /**
22
     * @Route("/login", name="login")
23
     *
24
     * @return array
25
     * @Method({"GET", "POST"})
26
     * @Template("@App/login.html.twig")
27
     */
28 6
    public function loginAction()
29
    {
30 6
        $authenticationUtils = $this->get('security.authentication_utils');
31 6
        $error = $authenticationUtils->getLastAuthenticationError();
32 6
        $lastUsername = $authenticationUtils->getLastUsername();
33
34
        return [
35 6
            'last_username' => $lastUsername, //$lastUsername,
36 6
            'error' => $error,
37
        ];
38
    }
39
}
40