Symfony 7.4 / Twig / Doctrine DBAL auf herkömmlichem PHP-Webhosting. Versionierte Blockdokumente (v1-v3) mit unveränderlichen Revisionen, getrennten Entwürfen/Veröffentlichungen und optimistischer Konflikterkennung. Visueller Editor mit Strukturbaum, Live-Vorschau, responsiven Gerätewerten, Abschnittsvorlagen, Bildmediathek, Galerien und Effekten. Öffentliche Ausgabe ohne Editor-JavaScript. Geprüft: 41 PHP-Tests / 155 Assertions, 10 JavaScript-Modelltests. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
28 lines
913 B
PHP
28 lines
913 B
PHP
<?php
|
|
|
|
namespace App\Controller;
|
|
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
use Symfony\Component\Routing\Attribute\Route;
|
|
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
|
|
|
|
final class SecurityController extends AbstractController
|
|
{
|
|
#[Route('/admin/login', name: 'admin_login', methods: ['GET', 'POST'])]
|
|
public function login(AuthenticationUtils $auth): Response
|
|
{
|
|
if ($this->getUser()) {
|
|
return $this->redirectToRoute('admin_pages');
|
|
}
|
|
|
|
return $this->render('admin/login.html.twig', ['error' => $auth->getLastAuthenticationError(), 'username' => $auth->getLastUsername()]);
|
|
}
|
|
|
|
#[Route('/admin/logout', name: 'admin_logout', methods: ['POST'])]
|
|
public function logout(): never
|
|
{
|
|
throw new \LogicException('Handled by Symfony Security.');
|
|
}
|
|
}
|