From 7334011d30d93c36176d149b48a8e19d63c25106 Mon Sep 17 00:00:00 2001 From: Happy-melon Date: Mon, 7 Sep 2009 19:00:49 +0000 Subject: [PATCH] * Totally refactor includes/specials/SpecialUserlogin.php: ** Split backend stuff out into includes/Login.php ** Split account creation and login stuff up, into includes/specials/CreateAccount.php and includes/specials/Userlogin.php. * Reimplement the special pages as subclasses of SpecialPage * Use HTMLForm to generate the input forms ** Deprecate and delete includes/templates/Userlogin.php, which is horrible and old :D This changes the syntax of the UserLoginForm and UserCreateForm hooks, and AuthPlugin::modifyUITemplate; they now receive the SpecialPage subclass rather than the template to work with. Update everything I could find in SVN to accommodate this. --- ConfirmEdit_body.php | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/ConfirmEdit_body.php b/ConfirmEdit_body.php index 8c0d780..4ec7ff5 100644 --- a/ConfirmEdit_body.php +++ b/ConfirmEdit_body.php @@ -39,8 +39,8 @@ class ConfirmEditHooks { return self::getInstance()->triggerUserLogin( $user, $password, $retval ); } - static function injectUserLogin( &$template ) { - return self::getInstance()->injectUserLogin( $template ); + static function injectUserLogin( &$sp ) { + return self::getInstance()->injectUserLogin( $sp ); } static function confirmUserLogin( $u, $pass, &$retval ) { @@ -144,18 +144,18 @@ class SimpleCaptcha { * @param SimpleTemplate $template * @return bool true to keep running callbacks */ - function injectUserCreate( &$template ) { + function injectUserCreate( &$sp ) { global $wgCaptchaTriggers, $wgOut, $wgUser; if ( $wgCaptchaTriggers['createaccount'] ) { if ( $wgUser->isAllowed( 'skipcaptcha' ) ) { wfDebug( "ConfirmEdit: user group allows skipping captcha on account creation\n" ); return true; } - $template->set( 'header', + $sp->mFormHeader .= "
" . $wgOut->parse( $this->getMessage( 'createaccount' ) ) . $this->getForm() . - "
\n" ); + "\n"; } return true; } @@ -163,18 +163,17 @@ class SimpleCaptcha { /** * Inject a captcha into the user login form after a failed * password attempt as a speedbump for mass attacks. - * @fixme if multiple thingies insert a header, could break * @param SimpleTemplate $template * @return bool true to keep running callbacks */ - function injectUserLogin( &$template ) { + function injectUserLogin( &$sp ) { if ( $this->isBadLoginTriggered() ) { global $wgOut; - $template->set( 'header', + $sp->mFormHeader .= "
" . $wgOut->parse( $this->getMessage( 'badlogin' ) ) . $this->getForm() . - "
\n" ); + "\n"; } return true; } @@ -190,7 +189,7 @@ class SimpleCaptcha { */ function triggerUserLogin( $user, $password, $retval ) { global $wgCaptchaTriggers, $wgCaptchaBadLoginExpiration, $wgMemc; - if ( $retval == LoginForm::WRONG_PASS && $wgCaptchaTriggers['badlogin'] ) { + if ( $retval == Login::WRONG_PASS && $wgCaptchaTriggers['badlogin'] ) { $key = $this->badLoginKey(); $count = $wgMemc->get( $key ); if ( !$count ) { @@ -557,7 +556,7 @@ class SimpleCaptcha { if ( !$this->passCaptcha() ) { $message = wfMsg( 'captcha-badlogin-fail' ); // Emulate a bad-password return to confuse the shit out of attackers - $retval = LoginForm::WRONG_PASS; + $retval = Login::WRONG_PASS; return false; } } -- 2.39.5