How to block user registration for bad guy email accounts

George Sypsomos Posted in Technical Support 4 years ago

I have a list of email accounts that perhaps are compromised, because they were used to create many fake accounts on my new site. I want to add them to a file on my server, that is checked when the registration form is submitted, and if they are using an email address from there it will present an error to them saying that email address is already used.

Replies
us Juan mart Replied 4 years ago

where is this file located to add this code?

Indonesian Arsalan Shah Replied 4 years ago

You need to write a component as follow example (untested)

<?php
function my_custom_filter_init() {
        ossn_add_hook('user', 'create', 'user_create_filter');
}
function user_create_filter($hook, $type, $return, $params) {
        if(isset($params['instance']->email)) {
                $slice = explode("@", $params['instance']->email);
                if(isset($slice[1])) {
                        $blocked_domains = array(
                                'domain.com',
                                'domain2.com',
                        );
                        $host            = $slice[1];
                        if(in_array($host, $blocked_domains)) {
                                return false;
                        }
                }
        }
        return $return;
}
ossn_register_callback('ossn', 'init', 'my_custom_filter_init');

.