db.auth_user.email.requires.append(IS_MATCH(r'.+@mywebsite.edu$',
                                            error_message='Only 
@mywebsite.edu addresses allowed.'))

The db.auth_user.email field has a default set of validators, so you don't 
want to overwrite its "requires" attribute -- instead, simply append an 
additional IS_MATCH validator to confirm the address matches the desired 
regular expression pattern.

Anthony

On Wednesday, August 15, 2018 at 11:12:37 AM UTC-4, Erik wrote:
>
> I googled this extensively, but didn't find anything useful on it.
>
> I want to be able to restrict user registration to a single domain (maybe 
> even to just email addresses that end in .edu). Is there a simple way to 
> add this extra check to the current registration within an app?
>
> For example I just want users who have email address ending in 
> mywebsite.edu to be able to create an account, all other emails should be 
> rejected.
>
> Thank you!
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.

Reply via email to