Merge "Check validity and availability of usernames during signup via AJAX"
[lhc/web/wiklou.git] / includes / api / ApiLogin.php
index 13e58b8..cba2134 100644 (file)
@@ -52,6 +52,7 @@ class ApiLogin extends ApiBase {
                                'result' => 'Aborted',
                                'reason' => 'Cannot log in when using a callback',
                        ) );
+
                        return;
                }
 
@@ -131,7 +132,9 @@ class ApiLogin extends ApiBase {
                                $result['result'] = 'NotExists';
                                break;
 
-                       case LoginForm::RESET_PASS: // bug 20223 - Treat a temporary password as wrong. Per SpecialUserLogin - "The e-mailed temporary password should not be used for actual logins;"
+                       // bug 20223 - Treat a temporary password as wrong. Per SpecialUserLogin:
+                       // The e-mailed temporary password should not be used for actual logins.
+                       case LoginForm::RESET_PASS:
                        case LoginForm::WRONG_PASS:
                                $result['result'] = 'WrongPass';
                                break;
@@ -255,24 +258,39 @@ class ApiLogin extends ApiBase {
        public function getDescription() {
                return array(
                        'Log in and get the authentication tokens.',
-                       'In the event of a successful log-in, a cookie will be attached',
-                       'to your session. In the event of a failed log-in, you will not',
-                       'be able to attempt another log-in through this method for 5 seconds.',
-                       'This is to prevent password guessing by automated password crackers'
+                       'In the event of a successful log-in, a cookie will be attached to your session.',
+                       'In the event of a failed log-in, you will not be able to attempt another log-in',
+                       'through this method for 5 seconds. This is to prevent password guessing by',
+                       'automated password crackers.'
                );
        }
 
        public function getPossibleErrors() {
                return array_merge( parent::getPossibleErrors(), array(
-                       array( 'code' => 'NeedToken', 'info' => 'You need to resubmit your login with the specified token. See https://bugzilla.wikimedia.org/show_bug.cgi?id=23076' ),
+                       array(
+                               'code' => 'NeedToken', 'info' => 'You need to resubmit your ' .
+                               'login with the specified token. See ' .
+                                       'https://bugzilla.wikimedia.org/show_bug.cgi?id=23076'
+                       ),
                        array( 'code' => 'WrongToken', 'info' => 'You specified an invalid token' ),
                        array( 'code' => 'NoName', 'info' => 'You didn\'t set the lgname parameter' ),
                        array( 'code' => 'Illegal', 'info' => 'You provided an illegal username' ),
                        array( 'code' => 'NotExists', 'info' => 'The username you provided doesn\'t exist' ),
-                       array( 'code' => 'EmptyPass', 'info' => 'You didn\'t set the lgpassword parameter or you left it empty' ),
+                       array(
+                               'code' => 'EmptyPass',
+                               'info' => 'You didn\'t set the lgpassword parameter or you left it empty'
+                       ),
                        array( 'code' => 'WrongPass', 'info' => 'The password you provided is incorrect' ),
-                       array( 'code' => 'WrongPluginPass', 'info' => 'Same as "WrongPass", returned when an authentication plugin rather than MediaWiki itself rejected the password' ),
-                       array( 'code' => 'CreateBlocked', 'info' => 'The wiki tried to automatically create a new account for you, but your IP address has been blocked from account creation' ),
+                       array(
+                               'code' => 'WrongPluginPass',
+                               'info' => 'Same as "WrongPass", returned when an authentication ' .
+                                       'plugin rather than MediaWiki itself rejected the password'
+                       ),
+                       array(
+                               'code' => 'CreateBlocked',
+                               'info' => 'The wiki tried to automatically create a new account ' .
+                                       'for you, but your IP address has been blocked from account creation'
+                       ),
                        array( 'code' => 'Throttled', 'info' => 'You\'ve logged in too many times in a short time' ),
                        array( 'code' => 'Blocked', 'info' => 'User is blocked' ),
                ) );