Passed
Push — main ( bfbca3...f1aa52 )
by Karl
08:21
created

SecurityController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
eloc 9
c 1
b 0
f 1
dl 0
loc 21
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A login() 0 12 1
A logout() 0 4 1
1
<?php
2
3
namespace App\Controller\Kassabok;
4
5
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
6
use Symfony\Component\HttpFoundation\Response;
7
use Symfony\Component\Routing\Attribute\Route;
8
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
9
10
class SecurityController extends AbstractController
11
{
12
    #[Route(path: '/proj/login', name: 'kassabok_login')]
13
    public function login(AuthenticationUtils $authenticationUtils): Response
14
    {
15
        // get the login error if there is one
16
        $error = $authenticationUtils->getLastAuthenticationError();
17
18
        // last username entered by the user
19
        $lastUsername = $authenticationUtils->getLastUsername();
20
21
        return $this->render('kassabok/security/login.html.twig', [
22
            'last_username' => $lastUsername,
23
            'error' => $error,
24
        ]);
25
    }
26
27
    #[Route(path: '/proj/logout', name: 'kassabok_logout')]
28
    public function logout(): void
29
    {
30
        throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
31
    }
32
}
33