Add email validation check
Co-authored-by: Reimar <mail@reim.ar>
This commit is contained in:
parent
65cd15d55e
commit
b6f8d96afe
@ -16,6 +16,11 @@ namespace API.Application.Users.Commands
|
|||||||
|
|
||||||
public async Task<ActionResult<Guid>> Handle(SignUpDTO signUpDTO)
|
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();
|
List<User> existingUsers = await _repository.QueryAllUsersAsync();
|
||||||
|
|
||||||
foreach (User existingUser in existingUsers)
|
foreach (User existingUser in existingUsers)
|
||||||
|
Loading…
Reference in New Issue
Block a user