X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiAMCreateAccount.php;h=5d12590fdf77e050caddca32ba1cc58b7e1f0e71;hb=8642482ee1618aa867e119bd34e5928398590608;hp=0a4b6dc214c3e6170c2ee4cdf18fd5f61d947449;hpb=8799a1ecc0bab78912a75a8a4f331bf0a05d8039;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiAMCreateAccount.php b/includes/api/ApiAMCreateAccount.php index 0a4b6dc214..5d12590fdf 100644 --- a/includes/api/ApiAMCreateAccount.php +++ b/includes/api/ApiAMCreateAccount.php @@ -21,7 +21,6 @@ */ use MediaWiki\Auth\AuthManager; -use MediaWiki\Auth\AuthenticationRequest; use MediaWiki\Auth\AuthenticationResponse; /** @@ -57,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}" ); } @@ -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() {