From: Evan Prodromou Date: Mon, 18 Apr 2011 14:44:41 +0000 (-0400) Subject: check for email domain when validating email X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=dfbb4eaa894185f61bb0544168ceab6da82253f9;p=quix0rs-gnu-social.git check for email domain when validating email --- diff --git a/plugins/DomainWhitelist/DomainWhitelistPlugin.php b/plugins/DomainWhitelist/DomainWhitelistPlugin.php index 3add6fad95..615701f36b 100644 --- a/plugins/DomainWhitelist/DomainWhitelistPlugin.php +++ b/plugins/DomainWhitelist/DomainWhitelistPlugin.php @@ -52,6 +52,22 @@ class DomainWhitelistPlugin extends Plugin return true; } + function onStartValidateUserEmail($user, $email, &$valid) + { + if (!$this->matchesWhitelist($email)) { + $whitelist = $this->getWhitelist(); + if (count($whitelist) == 1) { + $message = sprintf(_("Email address must be in this domain: %s"), + $whitelist[0]); + } else { + $message = sprintf(_("Email address must be in one of these domains: %s"), + implode(', ', $whitelist)); + } + throw new ClientException($message); + } + return true; + } + function onStartAddEmailAddress($user, $email) { if (!$this->matchesWhitelist($email)) {