From 55ebddb5fd897e8e87fbf9b279d9b5d32f938032 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 18 Apr 2011 10:44:55 -0400 Subject: [PATCH] catch exceptions and show them when validating email --- plugins/EmailRegistration/emailregister.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/plugins/EmailRegistration/emailregister.php b/plugins/EmailRegistration/emailregister.php index 53eb3778d9..8113111a6c 100644 --- a/plugins/EmailRegistration/emailregister.php +++ b/plugins/EmailRegistration/emailregister.php @@ -211,13 +211,18 @@ class EmailregisterAction extends Action $valid = false; - if (Event::handle('StartValidateUserEmail', array(null, $this->email, &$valid))) { - $valid = Validate::email($this->email, common_config('email', 'check_domain')); - Event::handle('EndValidateUserEmail', array(null, $this->email, &$valid)); - } - - if (!$valid) { - $this->error = _('Not a valid email address.'); + try { + if (Event::handle('StartValidateUserEmail', array(null, $this->email, &$valid))) { + $valid = Validate::email($this->email, common_config('email', 'check_domain')); + Event::handle('EndValidateUserEmail', array(null, $this->email, &$valid)); + } + if (!$valid) { + $this->error = _('Not a valid email address.'); + $this->showRegistrationForm(); + return; + } + } catch (ClientException $e) { + $this->error = $e->getMessage(); $this->showRegistrationForm(); return; }