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

Clayton ccornell at openoffice.org
Thu Dec 9 18:49:56 UTC 2010


On 12/04/2010 12:39 AM, Platonides wrote:
[snip]
>>> Is there any practical way of blocking new users from using specific
>>> services like Mailinator?  Is there a better way of dealing with
>>> situations like this?
>>>
>> http://www.mediawiki.org/wiki/Manual:Hooks/AbortNewAccount
>>
>> might work, dont know exactly what the docu means by 'incomplete'
>>
>> pesudocodey:
>>
>> $wgHooks['AbortNewAccount'][] = 'fnMyHook';
>> function fnMyHook( $user, $message ) {
>>    if( $user->getEmail() =~ /mailinator/ ) {
>>      $message = 'mailinator iz verbotten';
>>      return false;
>>    }
>> }
>
> That's a bit perlish ;)
> Try this instead, Clayton:
>
> $wgHooks['AbortNewAccount'][] = 'noMailinator';
>
> function noMailinator( $user,&$message ) {
>     if( !preg_match( '/@(mailinator|binkmail).com$/', $user->getEmail() ) {
>       $message = 'No mailinator emails, please';
>       return false;
>     }
>     return true;
> }
>
>
> Another option would be the isValidEmailAddr hook.

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.

C.



More information about the MediaWiki-l mailing list