HiRachel1208 (talk) This is the problem: I want that people must provide their E-mail address with fixed suffix like @gmail.com, and after confirmation, they can become users. Maybe to solve that problem, I need to change the login inerface and some other files. However, I don't know where to start.:( So I really need your helpRachel1208 (talk) Thank you for your kind replies! :)
Topic on Project:Support desk
You can probably use the isValidEmailAddr hook to check if the email is from specific domains, and set $result to false if it doesn't match.
Firstly, thank you for your kind reply! However, since I am a newcomer, the information that you provided to me as below is a bit difficult for me. - - - - - - - - - - - - - - Define function: public static function onisValidEmailAddr( $addr, &$result ) { ... }
Attach hook: $wgHooks['isValidEmailAddr'][] = 'MyExtensionHooks::onisValidEmailAddr';
Called from: Sanitizer.php - - - - - - - - - - - - - - Would you mind give me some details, like where should I define the function and the attach hook? What should I write in the function public static function onisValidEmailAddr( $addr, &$result ) { ... }?
Thanks a lot!:)
double post, sorry
Well, after a little test, I think the AbortNewAccount hook is better because it can provide an error message.
Simply put this in LocalSettings.php:
function onAbortNewAccount_emaildomain( $user, &$message ) {
if ( preg_match( "/@gmail\.com/i", $user->getEmail() ) !== 1 ) {
$message = "We only accept user registrations with email domain @gmail.com";
return false;
}
return true;
}
$wgHooks['AbortNewAccount'][] = 'onAbortNewAccount_emaildomain';
There's also an extension for this Extension:CheckEmailAddress.
Awesome! Thanks a lot!!