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

@ -94,6 +94,7 @@ $config = array(
'account_create_character_create' => true, // allow directly to create character on create account page? 'account_create_character_create' => true, // allow directly to create character on create account page?
'account_mail_verify' => false, // force users to confirm their email addresses when registering account 'account_mail_verify' => false, // force users to confirm their email addresses when registering account
'account_mail_unique' => true, // email addresses cannot be duplicated? (one account = one email) 'account_mail_unique' => true, // email addresses cannot be duplicated? (one account = one email)
'account_mail_block_plus_sign' => true, // block email with '+' signs like test+box@gmail.com (help protect against spamming accounts)
'account_premium_days' => 0, // default premium days on new account 'account_premium_days' => 0, // default premium days on new account
'account_premium_points' => 0, // default premium points on new account 'account_premium_points' => 0, // default premium points on new account
'account_welcome_mail' => true, // send welcome email when user registers 'account_welcome_mail' => true, // send welcome email when user registers

View File

@ -117,6 +117,14 @@ class Validator
return false; 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)) { 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.'; self::$lastError = 'Invalid e-mail format.';
return false; return false;