Yep, just tried it, and it appears to be working well! Thanks a lot, Andrew.

-Lamps

On Thursday, January 31, 2013 10:31:22 AM UTC-5, Andrew Buchan wrote:
>
> Lamps,
>
> I believe using banned is the best way of doing it. You would cover 
> multiple domains in the regex. 
>
> The following snippet would ensure that addresses ending in gmail.com or 
> hotmail.com fail registration...
>
> auth_table.email.requires = [
>   IS_EMAIL(error_message=auth.messages.invalid_email, 
> banned='^.*gmail\.com$|^.*hotmail\.com$'),  
>   IS_NOT_IN_DB(db, auth_table.email)
>   ]
>
> Remember that the model files are plain python, so you could build up the 
> regex string from a list or external source before passing it to as a 
> parameter.
>
> regards,
>
> Andy.
>
>
> On Thursday, January 31, 2013 12:29:18 PM UTC, Lamps902 wrote:
>>
>> Hi, web2py users. Is there a preferred method for banning a set of email 
>> domains from registering? I know that the IS_EMAIL() validator has a 
>> "banned" parameter, but is this the best way to go about this task? If so, 
>> is there a way to pass multiple domains to the "banned" parameter (I don't 
>> think it accepts a list)? Also, is this: 
>> ('^.*\domain_you_want_to_ban.com(|\..*)$') 
>> a reasonable regex for this purpose? Thank you.
>>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to