X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiLogin.php;h=2bd773a4a7789eb4bfa7ce3255947be56c6930ac;hb=d6c5ef7a5dec68105b03ff700faf27d98d5e804e;hp=8fb4604d77d8172368f390be870d24f225cdaa6d;hpb=7bb661a0d216f4dad2dc44da5d55450e1cb12464;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiLogin.php b/includes/api/ApiLogin.php index 8fb4604d77..2bd773a4a7 100644 --- a/includes/api/ApiLogin.php +++ b/includes/api/ApiLogin.php @@ -1,9 +1,8 @@ @gmail.com, * Daniel Cannon (cannon dot danielc at gmail dot com) @@ -20,8 +19,10 @@ * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * http://www.gnu.org/copyleft/gpl.html + * + * @file */ if ( !defined( 'MEDIAWIKI' ) ) { @@ -68,10 +69,11 @@ class ApiLogin extends ApiBase { } $loginForm = new LoginForm( $req ); + + global $wgCookiePrefix, $wgUser, $wgPasswordAttemptThrottle; + switch ( $authRes = $loginForm->authenticateUserData() ) { case LoginForm::SUCCESS: - global $wgUser, $wgCookiePrefix; - $wgUser->setOption( 'rememberpassword', 1 ); $wgUser->setCookies(); @@ -87,12 +89,14 @@ class ApiLogin extends ApiBase { $result['cookieprefix'] = $wgCookiePrefix; $result['sessionid'] = session_id(); break; - + case LoginForm::NEED_TOKEN: $result['result'] = 'NeedToken'; $result['token'] = $loginForm->getLoginToken(); + $result['cookieprefix'] = $wgCookiePrefix; + $result['sessionid'] = session_id(); break; - + case LoginForm::WRONG_TOKEN: $result['result'] = 'WrongToken'; break; @@ -128,7 +132,6 @@ class ApiLogin extends ApiBase { break; case LoginForm::THROTTLED: - global $wgPasswordAttemptThrottle; $result['result'] = 'Throttled'; $result['wait'] = intval( $wgPasswordAttemptThrottle['seconds'] ); break; @@ -176,7 +179,7 @@ class ApiLogin extends ApiBase { '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.' + 'This is to prevent password guessing by automated password crackers' ); }