From 122b38f354284eede7474fe05c00de75ecd86e60 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 18 Apr 2011 13:26:46 -0400 Subject: [PATCH] check for valid email on invite --- actions/invite.php | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/actions/invite.php b/actions/invite.php index 35606037f3..8bc2e4808a 100644 --- a/actions/invite.php +++ b/actions/invite.php @@ -80,15 +80,28 @@ class InviteAction extends CurrentUserDesignAction $email = trim($email); $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)); - } + try { + + if (Event::handle('StartValidateUserEmail', array(null, $email, &$valid))) { + $valid = Validate::email($email, common_config('email', 'check_domain')); + Event::handle('EndValidateUserEmail', array(null, $email, &$valid)); + } - if (!$valid) { - // TRANS: Form validation message when providing an e-mail address that does not validate. - // TRANS: %s is an invalid e-mail address. - $this->showForm(sprintf(_('Invalid email address: %s.'), $email)); + if ($valid) { + if (Event::handle('StartValidateEmailInvite', array($user, $email, &$valid))) { + $valid = true; + Event::handle('EndValidateEmailInvite', array($user, $email, &$valid)); + } + } + + if (!$valid) { + // TRANS: Form validation message when providing an e-mail address that does not validate. + // TRANS: %s is an invalid e-mail address. + $this->showForm(sprintf(_('Invalid email address: %s.'), $email)); + return; + } + } catch (ClientException $e) { + $this->showForm($e->getMessage()); return; } } -- 2.39.5