Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
90.00% |
9 / 10 |
|
66.67% |
2 / 3 |
CRAP | |
0.00% |
0 / 1 |
| LoginFormController | |
90.00% |
9 / 10 |
|
66.67% |
2 / 3 |
3.01 | |
0.00% |
0 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| login | |
100.00% |
8 / 8 |
|
100.00% |
1 / 1 |
1 | |||
| logout | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace App\Controller\Security; |
| 6 | |
| 7 | use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; |
| 8 | use Symfony\Component\HttpFoundation\Response; |
| 9 | use Symfony\Component\Routing\Attribute\Route; |
| 10 | use Symfony\Component\Security\Http\Authentication\AuthenticationUtils; |
| 11 | |
| 12 | class LoginFormController extends AbstractController |
| 13 | { |
| 14 | public function __construct(private readonly AuthenticationUtils $authenticationUtils) {} |
| 15 | |
| 16 | #[Route('/login', name: 'login', methods: ['GET', 'POST'])] |
| 17 | public function login(string $oauthGoogleId): Response |
| 18 | { |
| 19 | return $this->render( |
| 20 | 'auth/login.html.twig', |
| 21 | [ |
| 22 | 'last_username' => $this->authenticationUtils->getLastUsername(), |
| 23 | 'error' => $this->authenticationUtils->getLastAuthenticationError(), |
| 24 | 'oauthGoogleId' => $oauthGoogleId, |
| 25 | ] |
| 26 | ); |
| 27 | } |
| 28 | |
| 29 | #[Route('/logout', name: 'logout', methods: ['GET'])] |
| 30 | public function logout(): void {} |
| 31 | } |