]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/DomainStatusNetwork/actions/globalregister.php
Merge branch 'nightly' of git.gnu.io:gnu/gnu-social into nightly
[quix0rs-gnu-social.git] / plugins / DomainStatusNetwork / actions / globalregister.php
index 42dd207f4eb3f43de937993028deb1d9b40bb41f..1e34261099a80b7e1ed2be1d05652d6a887b000e 100644 (file)
@@ -57,8 +57,17 @@ class GlobalregisterAction extends GlobalApiAction
 
     function prepare($argarray)
     {
-        parent::prepare($argarray);
-        return true;
+        try {
+            parent::prepare($argarray);
+            return true;
+        } catch (ClientException $e) {
+            $this->showError($e->getMessage(), $e->getCode());
+            return false;
+        } catch (Exception $e) {
+            common_log(LOG_ERR, $e->getMessage());
+            $this->showError(_('An internal error occurred.'), 500);
+            return false;
+        }
     }
 
     /**
@@ -72,13 +81,14 @@ class GlobalregisterAction extends GlobalApiAction
     function handle($argarray=null)
     {
         try {
-            DomainStatusNetworkPlugin::registerEmail($this->email, true);
+            $confirm = DomainStatusNetworkPlugin::registerEmail($this->email);
+            EmailRegistrationPlugin::sendConfirmEmail($confirm);
             $this->showSuccess();
         } catch (ClientException $e) {
-            $this->showError($e->getMessage());
+            $this->showError($e->getMessage(), $e->getCode());
         } catch (Exception $e) {
             common_log(LOG_ERR, $e->getMessage());
-            $this->showError(_('An internal error occurred.'));
+            $this->showError(_('An internal error occurred.'), 500);
         }
 
         return;