Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions sources/AppBundle/Event/Form/TicketType.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\Email;

class TicketType extends AbstractType
{
Expand Down Expand Up @@ -70,6 +71,9 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
])
->add('email', EmailType::class, [
'label' => 'Email',
'constraints' => [
new Email(),
],
])
->add('phoneNumber', TextType::class, [
'label' => 'Téléphone',
Expand Down
2 changes: 2 additions & 0 deletions sources/AppBundle/Event/Model/Ticket.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use AppBundle\Event\Validator\Constraints as Assert;
use CCMBenchmark\Ting\Entity\NotifyProperty;
use CCMBenchmark\Ting\Entity\NotifyPropertyInterface;
use Symfony\Component\Validator\Constraints\Email;

#[Assert\LoggedInMember(groups: ['personal'])]
#[Assert\PublicTicket(groups: ['not_logged_in'])]
Expand Down Expand Up @@ -134,6 +135,7 @@ class Ticket implements NotifyPropertyInterface
/**
* @var string
*/
#[Email]
private $email;

/**
Expand Down
20 changes: 20 additions & 0 deletions tests/behat/features/EventPages/Ticketing.feature
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,23 @@ Feature: Event pages - Ticketing
When I press "Confirmer & Payer"
Then I should see "Paiement de vos billets"
And I should see "Vous serez redirigé vers notre partenaire paybox afin de procéder au paiement d'un montant de 15€"

@reloadDbWithTestData
Scenario: Refus des emails sans TLD lors de l'achat de billets
Given I am on "/event/forum/tickets"
Then I should see "Billetterie: forum"
And I select "0" from "purchase[paymentType]"
When I fill in "purchase[tickets][0][firstname]" with "Prénom personne 1"
And I fill in "purchase[tickets][0][lastname]" with "Nom personne 1"
# Email de billet sans extension de domaine (pas de TLD)
And I fill in "purchase[tickets][0][email]" with "personne1@hostname"
And I fill in "purchase[firstname]" with "Prénom facturation"
And I fill in "purchase[lastname]" with "Nom facturation"
And I fill in "purchase[address]" with "42 rue de Strasbourg"
And I fill in "purchase[zipcode]" with "75003"
And I fill in "purchase[city]" with "PARIS"
And I fill in "purchase[email]" with "facturationEntreprise@yahoo.fr"
And I check "purchase[cgv]"
When I press "Confirmer & Payer"
Then I should see "Cette valeur n'est pas une adresse email valide."
And I should not see "Paiement de vos billets"
Loading