]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
APIStartRegistrationTry event
authorhannes <h@nnesmannerhe.im>
Mon, 11 Jan 2016 20:04:31 +0000 (20:04 +0000)
committerhannes <h@nnesmannerhe.im>
Mon, 11 Jan 2016 20:04:31 +0000 (20:04 +0000)
actions/apiaccountregister.php

index 0d018007cdd5f1aec35d38bc58f241b3483ce759..2f3129001c576163135442a408cfd7e6bc178f40 100644 (file)
@@ -154,25 +154,27 @@ class ApiAccountRegisterAction extends ApiAction
 
             // annoy spammers
             sleep(7);
-
-            try {
-                $user = User::register(array('nickname' => $nickname,
-                                                    'password' => $password,
-                                                    'email' => $email,
-                                                    'fullname' => $fullname,
-                                                    'homepage' => $homepage,
-                                                    'bio' => $bio,
-                                                    'location' => $location,
-                                                    'code' => $this->code));
-                Event::handle('EndRegistrationTry', array($this));
-
-                $this->initDocument('json');
-                $this->showJsonObjects($this->twitterUserArray($user->getProfile()));
-                $this->endDocument('json');
-
-            } catch (Exception $e) {
-                $this->clientError($e->getMessage(), 400);
-            }
+            
+                       if (Event::handle('APIStartRegistrationTry', array($this))) { 
+                               try {
+                                       $user = User::register(array('nickname' => $nickname,
+                                                                                                               'password' => $password,
+                                                                                                               'email' => $email,
+                                                                                                               'fullname' => $fullname,
+                                                                                                               'homepage' => $homepage,
+                                                                                                               'bio' => $bio,
+                                                                                                               'location' => $location,
+                                                                                                               'code' => $this->code));
+                                       Event::handle('EndRegistrationTry', array($this));
+
+                                       $this->initDocument('json');
+                                       $this->showJsonObjects($this->twitterUserArray($user->getProfile()));
+                                       $this->endDocument('json');
+
+                               } catch (Exception $e) {
+                                       $this->clientError($e->getMessage(), 400);
+                               }                       
+                       }
         }
     }
 
@@ -195,4 +197,4 @@ class ApiAccountRegisterAction extends ApiAction
         return is_object($user);
     }
 
-}
+}
\ No newline at end of file