*

mheston

  • ***
  • 49 posts
Restrict sign up from certain emails
« on: November 22, 2021, 09:04:06 AM »
I would like to have new members only to be allowed to sign up with gmail, outlook etc emails. would this be the correct code, if yes where would I put it.


function cust_restrict_mail_providers() {

    $authorized_providers = array(
        'gmail.com',
        'hotmail.com'
    );
    $current_provider = preg_replace('/^.*@(.*)$/i', '$1', Params::getParam('s_email'));

    if (!in_array($current_provider, $authorized_providers)) {
        osc_add_flash_error_message( _m('Your current email is not allowed'));
        osc_redirect_to(osc_register_account_url()); exit;
    }
}

osc_add_hook('before_user_register', 'cust_restrict_mail_providers');

*

MB Themes

Re: Restrict sign up from certain emails
« Reply #1 on: November 22, 2021, 09:14:33 AM »
Simply create ban rules and add i.e. *@yahoo.ru,*@mail.ru

And similar...
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots