Check if user's email address is already used

This commit is contained in:
jvyden 2022-03-03 17:24:21 -05:00
commit bab48abcfd
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278

View file

@ -54,6 +54,13 @@ public class RegisterForm : BaseLayout
return this.Page();
}
if (ServerSettings.Instance.SMTPEnabled &&
await this.Database.Users.FirstOrDefaultAsync(u => u.EmailAddress.ToLower() == emailAddress.ToLower()) != null)
{
this.Error = "The email address you've chosen is already taken.";
return this.Page();
}
if (!await Request.CheckCaptchaValidity())
{
this.Error = "You must complete the captcha correctly.";