let other validity checks go through first
This commit is contained in:
parent
55ebddb5fd
commit
2019d32b3d
@ -52,18 +52,20 @@ class DomainWhitelistPlugin extends Plugin
|
||||
return true;
|
||||
}
|
||||
|
||||
function onStartValidateUserEmail($user, $email, &$valid)
|
||||
function onEndValidateUserEmail($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));
|
||||
if ($valid) { // it's otherwise 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);
|
||||
}
|
||||
throw new ClientException($message);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user