mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-05 11:28:39 +00:00
Add email blacklist and refactor email validity checks
This commit is contained in:
parent
8b8756e6de
commit
980a2af3c6
7 changed files with 71 additions and 23 deletions
|
@ -65,17 +65,13 @@ public class UserSettingsPage : BaseLayout
|
|||
}
|
||||
|
||||
if (ServerConfiguration.Instance.Mail.MailEnabled &&
|
||||
SanitizationHelper.IsValidEmail(email) &&
|
||||
SMTPHelper.IsValidEmail(this.Database, email) &&
|
||||
(this.User == this.ProfileUser || this.User.IsAdmin))
|
||||
{
|
||||
// if email hasn't already been used
|
||||
if (!await this.Database.Users.AnyAsync(u => u.EmailAddress != null && u.EmailAddress.ToLower() == email!.ToLower()))
|
||||
if (this.ProfileUser.EmailAddress != email)
|
||||
{
|
||||
if (this.ProfileUser.EmailAddress != email)
|
||||
{
|
||||
this.ProfileUser.EmailAddress = email;
|
||||
this.ProfileUser.EmailAddressVerified = false;
|
||||
}
|
||||
this.ProfileUser.EmailAddress = email;
|
||||
this.ProfileUser.EmailAddressVerified = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue