Add validation for email registration

This commit is contained in:
Ryan Prather 2024-06-09 20:18:27 -04:00
parent 4a6191e287
commit bdc67942ea

View File

@ -11,6 +11,7 @@ use Symfony\Bridge\Doctrine\Types\UuidType;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Uid\Uuid;
use Symfony\Component\Validator\Constraints as Assert;
#[ORM\Entity(repositoryClass: UserRepository::class)]
#[ORM\UniqueConstraint(name: 'UNIQ_IDENTIFIER_EMAIL', fields: ['email'])]
@ -23,6 +24,9 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface, JsonSer
private ?Uuid $id = null;
#[ORM\Column(length: 180)]
#[Assert\Email(
message: 'The email {{ value }} is not a valid email.',
)]
private ?string $email = null;
/**