diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2015-12-20 09:00:55 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2015-12-20 09:00:55 +0100 |
commit | a2190ac74dd4d7080b12bab90e552d7aa81209ef (patch) | |
tree | 8b31f38de9882d18df54cf8d9e0de74167a094eb /includes/api/ApiLogin.php | |
parent | 15e69f7b20b6596b9148030acce5b59993b95a45 (diff) | |
parent | 257401d8b2cf661adf36c84b0e3fd1cf85e33c22 (diff) |
Merge branch 'mw-1.26'
Diffstat (limited to 'includes/api/ApiLogin.php')
-rw-r--r-- | includes/api/ApiLogin.php | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/includes/api/ApiLogin.php b/includes/api/ApiLogin.php index 5480d940..c66e2156 100644 --- a/includes/api/ApiLogin.php +++ b/includes/api/ApiLogin.php @@ -24,6 +24,7 @@ * * @file */ +use MediaWiki\Logger\LoggerFactory; /** * Unit to authenticate log-in attempts to the current wiki. @@ -144,6 +145,10 @@ class ApiLogin extends ApiBase { case LoginForm::CREATE_BLOCKED: $result['result'] = 'CreateBlocked'; $result['details'] = 'Your IP address is blocked from account creation'; + $block = $context->getUser()->getBlock(); + if ( $block ) { + $result = array_merge( $result, ApiQueryUserInfo::getBlockInfo( $block ) ); + } break; case LoginForm::THROTTLED: @@ -154,6 +159,10 @@ class ApiLogin extends ApiBase { case LoginForm::USER_BLOCKED: $result['result'] = 'Blocked'; + $block = User::newFromName( $params['name'] )->getBlock(); + if ( $block ) { + $result = array_merge( $result, ApiQueryUserInfo::getBlockInfo( $block ) ); + } break; case LoginForm::ABORTED: @@ -166,6 +175,12 @@ class ApiLogin extends ApiBase { } $this->getResult()->addValue( null, 'login', $result ); + + LoggerFactory::getInstance( 'authmanager' )->info( 'Login attempt', array( + 'event' => 'login', + 'successful' => $authRes === LoginForm::SUCCESS, + 'status' => LoginForm::$statusCodes[$authRes], + ) ); } public function mustBePosted() { @@ -179,7 +194,9 @@ class ApiLogin extends ApiBase { public function getAllowedParams() { return array( 'name' => null, - 'password' => null, + 'password' => array( + ApiBase::PARAM_TYPE => 'password', + ), 'domain' => null, 'token' => null, ); |