<?php
/**
- * API for MediaWiki 1.8+
+ *
*
* Created on Sep 19, 2006
*
$loginForm = new LoginForm( $req );
- global $wgCookiePrefix;
+ global $wgCookiePrefix, $wgUser, $wgPasswordAttemptThrottle;
- switch ( $authRes = $loginForm->authenticateUserData() ) {
+ $authRes = $loginForm->authenticateUserData();
+ switch ( $authRes ) {
case LoginForm::SUCCESS:
- global $wgUser;
-
$wgUser->setOption( 'rememberpassword', 1 );
- $wgUser->setCookies();
+ $wgUser->setCookies( $this->getMain()->getRequest() );
// Run hooks. FIXME: split back and frontend from this hook.
// FIXME: This hook should be placed in the backend
break;
case LoginForm::THROTTLED:
- global $wgPasswordAttemptThrottle;
$result['result'] = 'Throttled';
$result['wait'] = intval( $wgPasswordAttemptThrottle['seconds'] );
break;
$result['result'] = 'Blocked';
break;
+ case LoginForm::ABORTED:
+ $result['result'] = 'Aborted';
+ $result['reason'] = $loginForm->mAbortLoginErrorMsg;
+ break;
+
default:
ApiBase::dieDebug( __METHOD__, "Unhandled case value: {$authRes}" );
}
public function getDescription() {
return array(
- 'This module is used to login and get the authentication tokens. ',
+ '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.',