Skip to content

Commit

Permalink
Block .ru and 163.com email addresses from registration #18
Browse files Browse the repository at this point in the history
  • Loading branch information
Clidus committed Aug 18, 2016
1 parent 2dbdb3c commit ffc9f77
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion ignition_application/controllers/ignition/auth.php
Expand Up @@ -20,7 +20,7 @@ function register()
$this->load->library('form_validation');

// form validation
$this->form_validation->set_rules('email', 'Email', 'trim|required|xss_clean');
$this->form_validation->set_rules('email', 'Email', 'trim|required|xss_clean|callback_email_tld_check');
$this->form_validation->set_rules('username', 'Username', 'trim|required|xss_clean');
$this->form_validation->set_rules('password', 'Password', 'trim|required|matches[conpassword]');
$this->form_validation->set_rules('conpassword', 'Confirm Password', 'trim|required');
Expand Down Expand Up @@ -56,6 +56,19 @@ function register()
}
}

public function email_tld_check($email)
{
if (preg_match("/\.ru|163\.com$/", $email) > 0)
{
$this->form_validation->set_message('email_tld_check', 'Sorry, we don\'t accept email addresses from this domain.');
return false;
}
else
{
return true;
}
}

// login user
function login()
{
Expand Down

0 comments on commit ffc9f77

Please sign in to comment.