r26526 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r26525‎ | r26526 | r26527 >
Date:03:30, 9 October 2007
Author:aaron
Status:old
Tags:
Comment:
*Fix throttler bug
Modified paths:
  • /trunk/extensions/ConfirmAccount/ConfirmAccount_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ConfirmAccount/ConfirmAccount_body.php
@@ -134,7 +134,6 @@
135135
136136 function doSubmit() {
137137 global $wgOut, $wgUser, $wgAuth, $wgAccountRequestThrottle, $wgMemc;
138 -
139138 # Now create a dummy user ($u) and check if it is valid
140139 $name = trim( $this->mUsername );
141140 $u = User::newFromName( $name, 'creatable' );
@@ -142,6 +141,15 @@
143142 $this->showForm( wfMsgHtml('noname') );
144143 return;
145144 }
 145+ # No request spamming...
 146+ if( $wgAccountRequestThrottle && ( !method_exists($u,'isPingLimitable') || $wgUser->isPingLimitable() ) ) {
 147+ $key = wfMemcKey( 'acctrequest', 'ip', wfGetIP() );
 148+ $value = $wgMemc->get( $key );
 149+ if( $value > $wgAccountRequestThrottle ) {
 150+ $this->throttleHit( $wgAccountRequestThrottle );
 151+ return;
 152+ }
 153+ }
146154 # Check if already in use
147155 if( 0 != $u->idForName() || $wgAuth->userExists( $u->getName() ) ) {
148156 $this->showForm( wfMsgHtml('userexists') );
@@ -220,7 +228,7 @@
221229 }
222230 if( $value > $wgAccountRequestThrottle ) {
223231 $this->throttleHit( $wgAccountRequestThrottle );
224 - return false;
 232+ return;
225233 }
226234 }
227235 # Done!

Status & tagging log