New config: account_mail_block_plus_sign

Block emails with '+' signs like test+box@gmail.com (help protect against spamming accounts)
This commit is contained in:
slawkens
2020-06-06 19:37:05 +02:00
parent e84c6f7a24
commit 3368fbd058
2 changed files with 9 additions and 0 deletions

View File

@@ -117,6 +117,14 @@ class Validator
return false;
}
if(config('account_mail_block_plus_sign')) {
$explode = explode('@', $email);
if(isset($explode[0]) && (strpos($explode[0],'+') !== false)) {
self::$lastError = 'Please do not use plus (+) sign in your e-mail.';
return false;
}
}
if(!preg_match('/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9_](?:[A-z0-9_\-](?!\.)){0,61}[a-zA-Z0-9_]?\.)+[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!$)){0,61}[a-zA-Z0-9_]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/', $email)) {
self::$lastError = 'Invalid e-mail format.';
return false;