Merge "Add CollationFa"
[lhc/web/wiklou.git] / includes / api / ApiAMCreateAccount.php
index 52a7951..5d12590 100644 (file)
@@ -56,8 +56,8 @@ class ApiAMCreateAccount extends ApiBase {
                        $bits = wfParseUrl( $params['returnurl'] );
                        if ( !$bits || $bits['scheme'] === '' ) {
                                $encParamName = $this->encodeParamName( 'returnurl' );
-                               $this->dieUsage(
-                                       "Invalid value '{$params['returnurl']}' for url parameter $encParamName",
+                               $this->dieWithError(
+                                       [ 'apierror-badurl', $encParamName, wfEscapeWikiText( $params['returnurl'] ) ],
                                        "badurl_{$encParamName}"
                                );
                        }
@@ -66,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;
                }
 
@@ -93,6 +95,7 @@ class ApiAMCreateAccount extends ApiBase {
 
                $this->getResult()->addValue( null, 'createaccount',
                        $helper->formatAuthenticationResponse( $res ) );
+               $helper->logAuthenticationResult( 'accountcreation', $res );
        }
 
        public function isReadMode() {