Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
SecurityController
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 2
6
0.00% covered (danger)
0.00%
0 / 1
 login
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 logout
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace App\Controller;
4
5use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
6use Symfony\Component\HttpFoundation\Response;
7use Symfony\Component\Routing\Annotation\Route;
8use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
9
10class SecurityController extends AbstractController
11{
12    /**
13     * @Route("/login", name="app_login")
14     */
15    public function login(AuthenticationUtils $authenticationUtils): Response
16    {
17        // if ($this->getUser()) {
18        //     return $this->redirectToRoute('target_path');
19        // }
20
21        // get the login error if there is one
22        $error = $authenticationUtils->getLastAuthenticationError();
23        // last username entered by the user
24        $lastUsername = $authenticationUtils->getLastUsername();
25
26        return $this->render('security/login.html.twig', ['last_username' => $lastUsername, 'error' => $error]);
27    }
28
29    /**
30     * @Route("/logout", name="app_logout")
31     */
32    public function logout(): void
33    {
34        throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
35    }
36}