Completed
Pull Request — master (#2737)
by
unknown
07:29
created

SecurityController::login()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 15
ccs 0
cts 9
cp 0
rs 9.7666
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Kunstmaan\AdminBundle\Controller;
4
5
use Kunstmaan\AdminBundle\Form\UserLoginType;
6
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
7
use Symfony\Component\Routing\Annotation\Route;
8
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
9
10
class SecurityController extends AbstractController
11
{
12
    /**
13
     * @Route("/login", name="cms_login", methods={"GET", "POST"})
14
     */
15
    public function login(AuthenticationUtils $authenticationUtils)
16
    {
17
        $error = $authenticationUtils->getLastAuthenticationError();
18
        $lastUsername = $authenticationUtils->getLastUsername();
19
        $form = $this->createForm(UserLoginType::class);
20
21
        return $this->render(
22
            '@KunstmaanAdmin/Security/login_cms.html.twig',
23
            [
24
                'form' => $form->createView(),
25
                'last_username' => $lastUsername,
26
                'error' => $error,
27
            ]
28
        );
29
    }
30
31
    /**
32
     * @Route("/logout", name="cms_logout")
33
     */
34
    public function logout()
35
    {
36
        throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
37
    }
38
}
39