events for validating outgoing invites

This commit is contained in:
Evan Prodromou 2011-04-11 16:49:28 -04:00
parent 25c5a1f0ef
commit 9c424cb7e6
2 changed files with 17 additions and 1 deletions

View File

@ -1342,3 +1342,12 @@ EndAddEmailAddress: done adding an email address through the Web UI
- $user: user getting the new address - $user: user getting the new address
- $email: email being added - $email: email being added
StartValidateEmailInvite: when validating an email address for invitations
- $user: user doing the invite
- $email: email address
- &$valid: flag for if it's valid; can be modified
EndValidateEmailInvite: after validating an email address for invitations
- $user: user doing the invite
- $email: email address
- &$valid: flag for if it's valid; can be modified

View File

@ -73,7 +73,14 @@ class InviteAction extends CurrentUserDesignAction
foreach ($addresses as $email) { foreach ($addresses as $email) {
$email = trim($email); $email = trim($email);
if (!Validate::email($email, common_config('email', 'check_domain'))) { $valid = null;
if (Event::handle('StartValidateEmailInvite', array($user, $email, &$valid))) {
$valid = Validate::email($email, common_config('email', 'check_domain'));
Event::handle('EndValidateEmailInvite', array($user, $email, &$valid));
}
if (!$valid) {
// TRANS: Form validation message when providing an e-mail address that does not validate. // TRANS: Form validation message when providing an e-mail address that does not validate.
// TRANS: %s is an invalid e-mail address. // TRANS: %s is an invalid e-mail address.
$this->showForm(sprintf(_('Invalid email address: %s.'), $email)); $this->showForm(sprintf(_('Invalid email address: %s.'), $email));