Add email validation check

Co-authored-by: Reimar <mail@reim.ar>
This commit is contained in:
Sandertp 2024-08-29 10:28:09 +02:00
parent 65cd15d55e
commit b6f8d96afe

View File

@ -16,6 +16,11 @@ namespace API.Application.Users.Commands
public async Task<ActionResult<Guid>> Handle(SignUpDTO signUpDTO)
{
if (!new Regex(@".+@.+\..+").IsMatch(signUpDTO.Email))
{
return new ConflictObjectResult(new{message = "Invalid email address."});
}
List<User> existingUsers = await _repository.QueryAllUsersAsync();
foreach (User existingUser in existingUsers)