mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-26 15:08: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
|
@ -129,9 +129,9 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.";
|
|||
if (message.StartsWith("/setemail ") && ServerConfiguration.Instance.Mail.MailEnabled)
|
||||
{
|
||||
string email = message[(message.IndexOf(" ", StringComparison.Ordinal)+1)..];
|
||||
if (!SanitizationHelper.IsValidEmail(email)) return this.Ok();
|
||||
|
||||
if (await this.database.Users.AnyAsync(u => u.EmailAddress == email)) return this.Ok();
|
||||
// Return a bad request on invalid email address
|
||||
if (!SMTPHelper.IsValidEmail(this.database, email)) return this.BadRequest();
|
||||
|
||||
UserEntity? user = await this.database.UserFromGameToken(token);
|
||||
if (user == null || user.EmailAddressVerified) return this.Ok();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue