[Mediawiki-l] Possible to block users from using a specific email service?

Platonides Platonides at gmail.com
Thu Dec 9 22:45:34 UTC 2010


Clayton wrote:
> Ok, this is the exact code I've added to the end of the 
> LocalSettings.php file:
> 
> ###################
> $wgHooks['AbortNewAccount'][] = 'noMailinator';
> 
> function noMailinator( $user, $message ) {
>     if( !preg_match( '/@(mailinator|binkmail).com$/', $user->getEmail() )) {
>       $message =  'One-time-use email services are forbidden on the 
> OpenOffice.org Wiki';
>       return false;
>     }
>     return true;
> }
> ###################
> 
> I created a test account using mailinator as the authentication email 
> address, and it went through and accepted the account creation.  So... 
> is there any way to trap or see what's happening at this stage?  I can't 
> see any reason the function doesn't work (now that I've got the right 
> number of parenthesis).  Given my (weak) knowledge of php, it seems to 
> follow what's documented.

The lack of ampersand before $message is likely to be blocking the hook
from running (PHP 5.3 is very nitpicking on this).
And yes, the original code missed a ), had a ! too much and should have
escaped the . inside the regex. It's also a good idea to make it case
insensitive (and legal per rfc822).




More information about the MediaWiki-l mailing list