Skip to content

Commit

Permalink
Avoid duplicate email addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-lerch committed Mar 22, 2024
1 parent c469277 commit 5b41173
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/TravelBlog/Controllers/RegistrationController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public async Task<IActionResult> Post([EmailAddress] string mailAddress, [Requir
if (!ModelState.IsValid)
return View("Index", new RegistrationViewModel(mailAddress, givenName, familyName, "Deine Angaben sind unvollständig oder ungültig!"));

// Avoid duplicate registrations with different casing or Gmail domains
mailAddress = mailAddress.ToLowerInvariant().Replace("@googlemail.com", "@gmail.com");

if (await subscriberService.Register(mailAddress, givenName, familyName))
return View("Success", new RegistrationViewModel(mailAddress, givenName, familyName));
else
Expand Down

0 comments on commit 5b41173

Please sign in to comment.