Merge "Remove recentchanges.rc_cur_time from sql statements"
[lhc/web/wiklou.git] / includes / api / ApiCreateAccount.php
index 9464d49..f25f5ae 100644 (file)
  */
 class ApiCreateAccount extends ApiBase {
        public function execute() {
+               // If we're in JSON callback mode, no tokens can be obtained
+               if ( !is_null( $this->getMain()->getRequest()->getVal( 'callback' ) ) ) {
+                       $this->dieUsage( 'Cannot create account when using a callback', 'aborted' );
+               }
 
                // $loginForm->addNewaccountInternal will throw exceptions
                // if wiki is read only (already handled by api), user is blocked or does not have rights.
@@ -168,6 +172,7 @@ class ApiCreateAccount extends ApiBase {
 
        public function getAllowedParams() {
                global $wgEmailConfirmToEdit;
+
                return array(
                        'name' => array(
                                ApiBase::PARAM_TYPE => 'user',
@@ -192,6 +197,7 @@ class ApiCreateAccount extends ApiBase {
 
        public function getParamDescription() {
                $p = $this->getModulePrefix();
+
                return array(
                        'name' => 'Username',
                        'password' => "Password (ignored if {$p}mailpassword is set)",
@@ -250,7 +256,7 @@ class ApiCreateAccount extends ApiBase {
                $errors = parent::getPossibleErrors();
                // All local errors are from LoginForm, which means they're actually message keys.
                foreach ( $localErrors as $error ) {
-                       $errors[] = array( 'code' => $error, 'info' => wfMessage( $error )->parse() );
+                       $errors[] = array( 'code' => $error, 'info' => wfMessage( $error )->inLanguage( 'en' )->useDatabase( false )->parse() );
                }
 
                $errors[] = array(
@@ -274,8 +280,9 @@ class ApiCreateAccount extends ApiBase {
                global $wgMinimalPasswordLength;
                $errors[] = array(
                        'code' => 'passwordtooshort',
-                       'info' => wfMessage( 'passwordtooshort', $wgMinimalPasswordLength )->parse()
+                       'info' => wfMessage( 'passwordtooshort', $wgMinimalPasswordLength )->inLanguage( 'en' )->useDatabase( false )->parse()
                );
+
                return $errors;
        }