diff --git a/functions.php b/functions.php index 6340e53..d162d1f 100644 --- a/functions.php +++ b/functions.php @@ -431,3 +431,20 @@ function restrict_rest_api_to_localhost() { } } add_action( 'rest_api_init', 'restrict_rest_api_to_localhost', 0 ); + +/* Security: filter email domains frequently used for spam registrations */ +function user_registration_filter($user_id, $email) { + if ($user_id == false) { + $e1 = explode("@", $email); + if (in_array($e1[1], array( + 'xtra.ltd','tmobile.agency','btee.online','verizonconnect.online', + 'eduonline.digital','vofadonepro.online'))) { + error_log( "user_registration_filter: email=" . $email . " blacklisted domain=" . $e1[1] ); + $user_id = 100; + } else { + error_log( "user_registration_filter: email=" . $email . " whitelisted domain=" . $e1[1] ); + } + } + return $user_id; +} +add_filter('email_exists', 'user_registration_filter', 10, 2);