Only allow signups from people with @___.com emails I want users to be able to signup to my Craft site, but only if they have a specific email domain. So:

*@gmail.com
*@hotmail.com


Would be allowed, but anyone with a yahoo.com email, for example, would not be able to sign up. I can do client-side validation but is there anything I can do in Craft?

Thanks!
One way of doing this is to write a custom plugin that intercepts the users.onBeforeSaveUser event.

You would check that the submitted email address matched your desired pattern and set $event-&gt;performAction = false if the criteria wasn't met. This would prevent the user from being saved.

So the init() method of your plugin might look something like this:

    public function init()
    {
        craft()-&gt;on('users.beforeSaveUser', function(Event $event) {

            // Retrieve the userModel from the event
            $user = $event-&gt;params['user'];
            $isNewUser = $event-&gt;params['isNewUser'];

            // Check if this is a front end request and that we are dealing with a new user
            if (craft()-&gt;request-&gt;isSiteRequest() &amp;&amp; $isNewUser) {

                // Check for valid email address
                if (email address doesn't match required pattern) {
                    // Cancel user save
                    $event-&gt;preformAction = false;
                }
            }
        });
    }