]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
catch exceptions and show them when validating email
authorEvan Prodromou <evan@status.net>
Mon, 18 Apr 2011 14:44:55 +0000 (10:44 -0400)
committerEvan Prodromou <evan@status.net>
Mon, 18 Apr 2011 14:44:55 +0000 (10:44 -0400)
plugins/EmailRegistration/emailregister.php

index 53eb3778d98d0d6c967fe868c3d9459a91064aef..8113111a6ce09d6b98a044ed3773700367d960d7 100644 (file)
@@ -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;
         }