Log human-readable login status
authorGergő Tisza <gtisza@wikimedia.org>
Fri, 7 Aug 2015 02:16:48 +0000 (02:16 +0000)
committerBryanDavis <bdavis@wikimedia.org>
Fri, 7 Aug 2015 15:37:38 +0000 (15:37 +0000)
Bug: T91701
Change-Id: Ia73fcc21321990befb1d866f76102b24d67adbfa

includes/api/ApiLogin.php
includes/specials/SpecialUserlogin.php

index e3d9295..8c65310 100644 (file)
@@ -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],
                ) );
        }
 
index f446a98..0b500f4 100644 (file)
@@ -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],
                ) );
        }