From 9c424cb7e639a58aa0bee83bb805f394173eaf03 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 11 Apr 2011 16:49:28 -0400 Subject: [PATCH] events for validating outgoing invites --- EVENTS.txt | 9 +++++++++ actions/invite.php | 9 ++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/EVENTS.txt b/EVENTS.txt index 6ac607382b..aca9e8f73d 100644 --- a/EVENTS.txt +++ b/EVENTS.txt @@ -1342,3 +1342,12 @@ EndAddEmailAddress: done adding an email address through the Web UI - $user: user getting the new address - $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 diff --git a/actions/invite.php b/actions/invite.php index 7a1f8b3f5b..be2228e703 100644 --- a/actions/invite.php +++ b/actions/invite.php @@ -73,7 +73,14 @@ class InviteAction extends CurrentUserDesignAction foreach ($addresses as $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: %s is an invalid e-mail address. $this->showForm(sprintf(_('Invalid email address: %s.'), $email)); -- 2.39.5