Skip to content

Contact page#63

Merged
rocambille merged 6 commits intodevfrom
contact_page
Oct 17, 2025
Merged

Contact page#63
rocambille merged 6 commits intodevfrom
contact_page

Conversation

@LucBlocker01
Copy link
Copy Markdown
Collaborator

No description provided.

Comment thread src/Controller/HomeController.php Outdated
Comment on lines +49 to +50
->from($request->request->get('email'))
->to('hureaux.lucas@gmail.com')
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ça me semble inversé : le mail est à envoyer "to" le mail indiqué dans le formulaire, "from" le mail de référence de l'entité qui administre le site (qui n'est pas ton mail)

Comment thread templates/home/contact.html.twig Outdated
{% block main %}
<article>
<h1>Contact</h1>
<form class="centerForm" action="{{path('app_contact_email')}}">
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C'est bon dans l'idée. Passe le formulaire en méthode POST plutôt (le formulaire sert à faire une action côté serveur, pas à obtenir une page avec des options particulières)

Comment thread templates/home/contact.html.twig Outdated
Comment on lines +10 to +11
<label>Email</label>
<input type="email" name="email" value="">
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tu dois lier les 2 pour l'a11y : un attribut for sur le label et un id sur l'input

Comment thread templates/home/contact.html.twig Outdated
Comment on lines +14 to +15
<label>Contenu</label>
<textarea rows=10 cols=60 name="content" value=""></textarea>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pareil

Comment on lines +17 to +19
<div>
<button class="btn">Envoyer</button>
</div>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Précise explicitement le type submit sur le bouton

Comment thread src/Controller/HomeController.php Outdated
return $this->render('home/contact.html.twig');
}

#[Route('/contact/email', name: 'app_contact_email')]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

méthod POST sur cette route

Comment thread src/Controller/HomeController.php Outdated
}

#[Route('/contact/email', name: 'app_contact_email')]
public function email(MailerInterface $mailer, Request $request): Response
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sendEmail plutôt que juste email

Comment thread src/Controller/HomeController.php Outdated
use Symfony\Component\Mailer\MailerInterface;
use Symfony\Component\Mime\Email;

class HomeController extends AbstractController
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Le controller n'est donc plus exclusivement pour la page Home : quel nom proposes-tu pour le renommer ?

Comment thread src/Controller/HomeController.php Outdated
Comment on lines +49 to +50
->from($this->getUser()->getEmail())
->to($request->request->get('email'))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

J'ai dit une bêtise tout à l'heure. Le mail "from" est celui du formulaire ($request->request->get('email)). Le mail "to" est celui de l'admin du site (qui n'est donc pas celui de l'utilisateur connecté)

@rocambille rocambille merged commit 910c031 into dev Oct 17, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants