On 12/09/2010 04:49:42 PM, Clayton - ccorn...@openoffice.org wrote:
> On 12/09/2010 10:27 PM, Jim Laurino wrote:
> > On 12/09/2010 01:49:56 PM, Clayton - ccorn...@openoffice.org 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?
> > [snip]
> >> 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.
> > [snip]
> > Try replacing the test with this:
> >
> > if( preg_match( '/@(mailinator|binkmail)\.com/i', .....
> >
> > preg_match() returns the number of matches, it will be zero (false) if 
> > there are none. [1]
> >
> > In addition the pattern is now case insensitive and the period is meant 
> > literally.
> > The "end of string" specification ($) seems superfluous and could cause 
> > trouble.
> >
> > [1] http://www.php.net/manual/en/function.preg-match.php
> >
> > Hope that helps.
> 
> I was wondering about escaping the dot... I also removed $ and added /i 
> for case insensitive as suggested... tested creating a new account using 
> mailinator as the authentication email and it still allows it through.
> 
[snip]

Did you also remove the NOT (!) in front of the preg_match() call? You did not 
say.

Have you tried it both ways? With this rule in place, can a non-mailinator 
account register?

Jim



_______________________________________________
MediaWiki-l mailing list
MediaWiki-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l

Reply via email to