X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiCreateAccount.php;h=be8286c0bfe22dc443f9f871198c7ae38c7773dd;hb=b5993f884a3c4b0012fca120d3625452408c159d;hp=439f46b9ad924978d26494d30caf856ab21d306d;hpb=75bbe1bbffd6009959ba94ba44b2e4bc9551f7fc;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiCreateAccount.php b/includes/api/ApiCreateAccount.php index 439f46b9ad..be8286c0bf 100644 --- a/includes/api/ApiCreateAccount.php +++ b/includes/api/ApiCreateAccount.php @@ -83,6 +83,7 @@ class ApiCreateAccount extends ApiBase { $loginForm = new LoginForm(); $loginForm->setContext( $context ); + wfRunHooks( 'AddNewAccountApiForm', array( $this, $loginForm ) ); $loginForm->load(); $status = $loginForm->addNewaccountInternal(); @@ -137,13 +138,13 @@ class ApiCreateAccount extends ApiBase { // since not having the correct token is part of the normal // flow of events. $result['token'] = LoginForm::getCreateaccountToken(); - $result['result'] = 'needtoken'; + $result['result'] = 'NeedToken'; } elseif ( !$status->isOK() ) { // There was an error. Die now. $this->dieStatus( $status ); } elseif ( !$status->isGood() ) { // Status is not good, but OK. This means warnings. - $result['result'] = 'warning'; + $result['result'] = 'Warning'; // Add any warnings to the result $warnings = $status->getErrorsByType( 'warning' ); @@ -156,9 +157,12 @@ class ApiCreateAccount extends ApiBase { } } else { // Everything was fine. - $result['result'] = 'success'; + $result['result'] = 'Success'; } + // Give extensions a chance to modify the API result data + wfRunHooks( 'AddNewAccountApiResult', array( $this, $loginForm, &$result ) ); + $apiResult->addValue( null, 'createaccount', $result ); } @@ -225,9 +229,9 @@ class ApiCreateAccount extends ApiBase { 'createaccount' => array( 'result' => array( ApiBase::PROP_TYPE => array( - 'success', - 'warning', - 'needtoken' + 'Success', + 'Warning', + 'NeedToken' ) ), 'username' => array(