SpecialActiveUsers: Change checkboxes to dropdown
[lhc/web/wiklou.git] / includes / api / ApiAMCreateAccount.php
index 806b8d2..2511e3b 100644 (file)
@@ -21,7 +21,6 @@
  */
 
 use MediaWiki\Auth\AuthManager;
-use MediaWiki\Auth\AuthenticationRequest;
 use MediaWiki\Auth\AuthenticationResponse;
 
 /**
@@ -67,13 +66,15 @@ class ApiAMCreateAccount extends ApiBase {
                $helper = new ApiAuthManagerHelper( $this );
                $manager = AuthManager::singleton();
 
-               // Make sure it's possible to log in
+               // Make sure it's possible to create accounts
                if ( !$manager->canCreateAccounts() ) {
                        $this->getResult()->addValue( null, 'createaccount', $helper->formatAuthenticationResponse(
                                AuthenticationResponse::newFail(
                                        $this->msg( 'userlogin-cannot-' . AuthManager::ACTION_CREATE )
                                )
                        ) );
+                       $helper->logAuthenticationResult( 'accountcreation',
+                               'userlogin-cannot-' . AuthManager::ACTION_CREATE );
                        return;
                }
 
@@ -94,6 +95,7 @@ class ApiAMCreateAccount extends ApiBase {
 
                $this->getResult()->addValue( null, 'createaccount',
                        $helper->formatAuthenticationResponse( $res ) );
+               $helper->logAuthenticationResult( 'accountcreation', $res );
        }
 
        public function isReadMode() {
@@ -109,9 +111,12 @@ class ApiAMCreateAccount extends ApiBase {
        }
 
        public function getAllowedParams() {
-               return ApiAuthManagerHelper::getStandardParams( AuthManager::ACTION_CREATE,
+               $ret = ApiAuthManagerHelper::getStandardParams( AuthManager::ACTION_CREATE,
                        'requests', 'messageformat', 'mergerequestfields', 'preservestate', 'returnurl', 'continue'
                );
+               $ret['preservestate'][ApiBase::PARAM_HELP_MSG_APPEND][] =
+                       'apihelp-createaccount-param-preservestate';
+               return $ret;
        }
 
        public function dynamicParameterDocumentation() {