Tweak audit hooks
authorBrion Vibber <brion@users.mediawiki.org>
Tue, 8 May 2007 18:31:32 +0000 (18:31 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Tue, 8 May 2007 18:31:32 +0000 (18:31 +0000)
ConfirmEdit.php

index 013ff4c33382e2550c5c7b34b1658ce86d6b464e..729322b9962cb3401f6173c40c04d4dd6a7fa2d8 100644 (file)
@@ -176,7 +176,7 @@ function ceSetup() {
        $wgHooks['UserCreateForm'][] = array( &$wgCaptcha, 'injectUserCreate' );
        $wgHooks['AbortNewAccount'][] = array( &$wgCaptcha, 'confirmUserCreate' );
        
        $wgHooks['UserCreateForm'][] = array( &$wgCaptcha, 'injectUserCreate' );
        $wgHooks['AbortNewAccount'][] = array( &$wgCaptcha, 'confirmUserCreate' );
        
-       $wgHooks['LoginBadPass'][] = array( &$wgCaptcha, 'triggerUserLogin' );
+       $wgHooks['LoginAuthenticateAudit'][] = array( &$wgCaptcha, 'triggerUserLogin' );
        $wgHooks['UserLoginForm'][] = array( &$wgCaptcha, 'injectUserLogin' );
        $wgHooks['AbortLogin'][] = array( &$wgCaptcha, 'confirmUserLogin' );
 }
        $wgHooks['UserLoginForm'][] = array( &$wgCaptcha, 'injectUserLogin' );
        $wgHooks['AbortLogin'][] = array( &$wgCaptcha, 'confirmUserLogin' );
 }
@@ -300,11 +300,12 @@ class SimpleCaptcha {
         * captcha display to prevent too many hits from the same place.
         * @param User $user
         * @param string $password
         * captcha display to prevent too many hits from the same place.
         * @param User $user
         * @param string $password
+        * @param int $retval authentication return value
         * @return bool true to keep running callbacks
         */
         * @return bool true to keep running callbacks
         */
-       function triggerUserLogin( $user, $password ) {
+       function triggerUserLogin( $user, $password, $retval ) {
                global $wgCaptchaTriggers, $wgCaptchaBadLoginExpiration, $wgMemc;
                global $wgCaptchaTriggers, $wgCaptchaBadLoginExpiration, $wgMemc;
-               if( $wgCaptchaTriggers['badlogin'] ) {
+               if( $retval == LoginForm::WRONG_PASS && $wgCaptchaTriggers['badlogin'] ) {
                        $key = $this->badLoginKey();
                        $count = $wgMemc->get( $key );
                        if( !$count ) {
                        $key = $this->badLoginKey();
                        $count = $wgMemc->get( $key );
                        if( !$count ) {