Add contact form with reCAPTCHA, saved to DB, viewable in admin
Adds a public /contact page (name/email/message, protected by the same reCAPTCHA v3 setup used on registration) that persists submissions to a new contact_message table, plus a Contact section in the admin panel to read them. Linked from the site footer.
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Game\Controller;
|
||||
|
||||
use App\Website\Repository\ContactMessageRepository;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
#[Route('/admin/contact')]
|
||||
#[IsGranted('ROLE_ADMIN')]
|
||||
final class GameAdminContactController extends AbstractController
|
||||
{
|
||||
#[Route('', name: 'game_admin_contact', methods: ['GET'])]
|
||||
public function index(ContactMessageRepository $contactMessageRepository): Response
|
||||
{
|
||||
return $this->render('game/admin/contact/index.html.twig', [
|
||||
'messages' => $contactMessageRepository->findBy([], ['createdAt' => 'DESC']),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user