From 3fe06d774c56fd252a9a95babd53e96bedb44d8e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gerg=C5=91=20Tisza?= Date: Fri, 7 Aug 2015 02:16:48 +0000 Subject: [PATCH] Log human-readable login status Bug: T91701 Change-Id: Ia73fcc21321990befb1d866f76102b24d67adbfa --- includes/api/ApiLogin.php | 2 +- includes/specials/SpecialUserlogin.php | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/includes/api/ApiLogin.php b/includes/api/ApiLogin.php index e3d9295c40..8c65310e6b 100644 --- a/includes/api/ApiLogin.php +++ b/includes/api/ApiLogin.php @@ -179,7 +179,7 @@ class ApiLogin extends ApiBase { LoggerFactory::getInstance( 'authmanager' )->info( 'Login attempt', array( 'event' => 'login', 'successful' => $authRes === LoginForm::SUCCESS, - 'status' => $authRes, + 'status' => LoginForm::$statusCodes[$authRes], ) ); } diff --git a/includes/specials/SpecialUserlogin.php b/includes/specials/SpecialUserlogin.php index f446a98f8f..0b500f4752 100644 --- a/includes/specials/SpecialUserlogin.php +++ b/includes/specials/SpecialUserlogin.php @@ -44,6 +44,24 @@ class LoginForm extends SpecialPage { const WRONG_TOKEN = 13; const USER_MIGRATED = 14; + public static $statusCodes = array( + self::SUCCESS => 'success', + self::NO_NAME => 'no_name', + self::ILLEGAL => 'illegal', + self::WRONG_PLUGIN_PASS => 'wrong_plugin_pass', + self::NOT_EXISTS => 'not_exists', + self::WRONG_PASS => 'wrong_pass', + self::EMPTY_PASS => 'empty_pass', + self::RESET_PASS => 'reset_pass', + self::ABORTED => 'aborted', + self::CREATE_BLOCKED => 'create_blocked', + self::THROTTLED => 'throttled', + self::USER_BLOCKED => 'user_blocked', + self::NEED_TOKEN => 'need_token', + self::WRONG_TOKEN => 'wrong_token', + self::USER_MIGRATED => 'user_migrated', + ); + /** * Valid error and warning messages * @@ -1049,7 +1067,7 @@ class LoginForm extends SpecialPage { LoggerFactory::getInstance( 'authmanager' )->info( 'Login attempt', array( 'event' => 'login', 'successful' => $status === self::SUCCESS, - 'status' => $status, + 'status' => LoginForm::$statusCodes[$status], ) ); } -- 2.20.1