*/
use MediaWiki\Auth\AuthManager;
-use MediaWiki\Auth\AuthenticationRequest;
use MediaWiki\Auth\AuthenticationResponse;
/**
$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}"
);
}
$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;
}
$this->getResult()->addValue( null, 'createaccount',
$helper->formatAuthenticationResponse( $res ) );
+ $helper->logAuthenticationResult( 'accountcreation', $res );
}
public function isReadMode() {