Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
85.71% |
6 / 7 |
|
50.00% |
1 / 2 |
CRAP | |
0.00% |
0 / 1 |
| SecurityController | |
85.71% |
6 / 7 |
|
50.00% |
1 / 2 |
2.01 | |
0.00% |
0 / 1 |
| login | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
1 | |||
| logout | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Controller\Admin; |
| 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("/login", name: "admin_login")] |
| 13 | public function login(AuthenticationUtils $authenticationUtils): Response |
| 14 | { |
| 15 | $error = $authenticationUtils->getLastAuthenticationError(); |
| 16 | $lastUsername = $authenticationUtils->getLastUsername(); |
| 17 | |
| 18 | return $this->render('admin/login.html.twig', [ |
| 19 | 'last_username' => $lastUsername, |
| 20 | 'error' => $error, |
| 21 | ]); |
| 22 | } |
| 23 | |
| 24 | #[Route("/logout", name: "admin_logout")] |
| 25 | public function logout(): void |
| 26 | { |
| 27 | throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.'); |
| 28 | } |
| 29 | } |