This is just a simple idea, teseo will probably get a better solution, and obviously haven't tested it, however maybe the fastest way to do this is by directly adding the rules inside register.php controller, before even hitting the database or anything.
controller > register.php
case('register_post'): //register user
osc_csrf_check();
if( !osc_users_enabled() ) {
osc_add_flash_error_message( _m('Users are not enabled') );
$this->redirectTo( osc_base_url() );
}
osc_run_hook('before_user_register');
$banned = osc_is_banned(Params::getParam('s_email'));
if($banned==1) {
osc_add_flash_error_message( _m('Your current email is not allowed'));
$this->redirectTo(osc_register_account_url());
} else if($banned==2) {
osc_add_flash_error_message( _m('Your current IP is not allowed'));
$this->redirectTo(osc_register_account_url());
}
///////////////////////////////////////////////////////////////////////////////////////////////
// add your rules here
if(strpos(Params::getParam('s_email'), '@university.org') !== true) {
osc_redirect_to(osc_register_account_url());
}
///////////////////////////////////////////////////////////////////////////////////////////////
// here original code continues...
require_once LIB_PATH . 'osclass/UserActions.php';
...
about 'rules goes here*', this still needs to be constructed.
Drawback is this is a core file, you need the backup it plus disable automatic updates, and be careful about future manual updates, since this file may be changed.
Regards