mirror of
https://github.com/MarijnDoeve/TijdVoorDeTest.git
synced 2026-03-07 05:04:20 +01:00
This commit introduces a refactored EliminationFactory for better modularity, updates the elimination preparation process, and adds functionality to view eliminations. Backoffice templates and forms have been reorganized, minor translations were corrected, and additional assets like styles and flashes were included for enhanced user experience.
43 lines
1.5 KiB
PHP
43 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Controller;
|
|
|
|
use App\Enum\FlashType;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
use Symfony\Component\HttpKernel\Attribute\AsController;
|
|
use Symfony\Component\Routing\Attribute\Route;
|
|
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
|
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
|
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
|
|
|
#[AsController]
|
|
final class LoginController extends AbstractController
|
|
{
|
|
#[Route(path: '/login', name: 'app_login_login')]
|
|
public function login(AuthenticationUtils $authenticationUtils, TranslatorInterface $translator): Response
|
|
{
|
|
// get the login error if there is one
|
|
$error = $authenticationUtils->getLastAuthenticationError();
|
|
|
|
// last username entered by the user
|
|
$lastUsername = $authenticationUtils->getLastUsername();
|
|
|
|
if ($error instanceof AuthenticationException) {
|
|
$this->addFlash(FlashType::Danger, $translator->trans($error->getMessageKey(), $error->getMessageData(), 'security'));
|
|
}
|
|
|
|
return $this->render('backoffice/login/login.html.twig', [
|
|
'last_username' => $lastUsername,
|
|
'error' => $error,
|
|
]);
|
|
}
|
|
|
|
#[Route(path: '/logout', name: 'app_login_logout')]
|
|
public function logout(): never
|
|
{
|
|
throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
|
|
}
|
|
}
|