Can I create a custom auth plugin and override this function?
What I am trying to do is add custom validation to email based self registration plugin. I read https://docs.moodle.org/dev/Authentication_plugins#user_signup.28.24user.2C_.24notify.3Dtrue.29 but can't getting this work.
Here is the code I am trying to alter,
if (! validate_email($data['email'])) {
$errors['email'] = get_string('invalidemail');
} else if ($DB->record_exists('user', array('email' => $data['email']))) {
$errors['email'] = get_string('emailexists').' <a href="forgot_password.php">'.get_string('newpassword').'?</a>';
}