Merge branch 'apiaccountregister_event_branch' into 'nightly'

APIStartRegistrationTry event



See merge request !77
This commit is contained in:
mmn 2016-01-11 21:08:09 +00:00
commit e4a1dff98d

View File

@ -155,24 +155,26 @@ class ApiAccountRegisterAction extends ApiAction
// annoy spammers // annoy spammers
sleep(7); sleep(7);
try { if (Event::handle('APIStartRegistrationTry', array($this))) {
$user = User::register(array('nickname' => $nickname, try {
'password' => $password, $user = User::register(array('nickname' => $nickname,
'email' => $email, 'password' => $password,
'fullname' => $fullname, 'email' => $email,
'homepage' => $homepage, 'fullname' => $fullname,
'bio' => $bio, 'homepage' => $homepage,
'location' => $location, 'bio' => $bio,
'code' => $this->code)); 'location' => $location,
Event::handle('EndRegistrationTry', array($this)); 'code' => $this->code));
Event::handle('EndRegistrationTry', array($this));
$this->initDocument('json'); $this->initDocument('json');
$this->showJsonObjects($this->twitterUserArray($user->getProfile())); $this->showJsonObjects($this->twitterUserArray($user->getProfile()));
$this->endDocument('json'); $this->endDocument('json');
} catch (Exception $e) { } catch (Exception $e) {
$this->clientError($e->getMessage(), 400); $this->clientError($e->getMessage(), 400);
} }
}
} }
} }