Index: trunk/extensions/ConfirmAccount/dataclasses/ConfirmAccount.class.php |
— | — | @@ -128,7 +128,8 @@ |
129 | 129 | * @return string|false |
130 | 130 | */ |
131 | 131 | public function requestNameFromEmailToken( $code ) { |
132 | | - return wfGetDB( DB_SLAVE )->selectField( 'account_requests', |
| 132 | + $dbr = wfGetDB( DB_SLAVE ); |
| 133 | + return $dbr->selectField( 'account_requests', |
133 | 134 | 'acr_name', |
134 | 135 | array( |
135 | 136 | 'acr_email_token' => md5( $code ), |
Index: trunk/extensions/ConfirmAccount/business/AccountRequestSubmission.php |
— | — | @@ -93,7 +93,7 @@ |
94 | 94 | return array( 'acct_request_skipped_tos', wfMsgHtml( 'requestaccount-agree' ) ); |
95 | 95 | } |
96 | 96 | # Validate email address |
97 | | - if ( !$u->isValidEmailAddr( $this->email ) ) { |
| 97 | + if ( !Sanitizer::validateEmail( $this->email ) ) { |
98 | 98 | return array( 'acct_request_invalid_email', wfMsgHtml( 'invalidemailaddress' ) ); |
99 | 99 | } |
100 | 100 | # Check if biography is long enough |
— | — | @@ -161,6 +161,9 @@ |
162 | 162 | } |
163 | 163 | $expires = null; // passed by reference |
164 | 164 | $token = ConfirmAccount::getConfirmationToken( $u, $expires ); |
| 165 | + |
| 166 | + global $wgRequest; |
| 167 | + $ip = $wgRequest->getIP(); |
165 | 168 | # Insert into pending requests... |
166 | 169 | $req = UserAccountRequest::newFromArray( array( |
167 | 170 | 'name' => $u->getName(), |
— | — | @@ -179,12 +182,12 @@ |
180 | 183 | 'comment' => '', |
181 | 184 | 'email_token' => md5( $token ), |
182 | 185 | 'email_token_expires' => $expires, |
183 | | - 'ip' => wfGetIP(), |
| 186 | + 'ip' => $ip, |
184 | 187 | ) ); |
185 | 188 | $dbw->begin(); |
186 | 189 | $req->insertOn(); |
187 | 190 | # Send confirmation, required! |
188 | | - $result = ConfirmAccount::sendConfirmationMail( $u, wfGetIP(), $token, $expires ); |
| 191 | + $result = ConfirmAccount::sendConfirmationMail( $u, $ip, $token, $expires ); |
189 | 192 | if ( !$result->isOK() ) { |
190 | 193 | $dbw->rollback(); // Nevermind |
191 | 194 | return array( 'acct_request_mail_failed', |
— | — | @@ -197,7 +200,7 @@ |
198 | 201 | # No request spamming... |
199 | 202 | # BC: check if isPingLimitable() exists |
200 | 203 | if ( $wgAccountRequestThrottle && $reqUser->isPingLimitable() ) { |
201 | | - $key = wfMemcKey( 'acctrequest', 'ip', wfGetIP() ); |
| 204 | + $key = wfMemcKey( 'acctrequest', 'ip', $ip ); |
202 | 205 | $value = $wgMemc->incr( $key ); |
203 | 206 | if ( !$value ) { |
204 | 207 | $wgMemc->set( $key, 1, 86400 ); |