Index: trunk/extensions/ConfirmAccount/business/AccountRequestSubmission.php |
— | — | @@ -14,6 +14,7 @@ |
15 | 15 | protected $type; |
16 | 16 | protected $areas; |
17 | 17 | protected $registration; |
| 18 | + protected $ip; |
18 | 19 | /* File attachment fields */ |
19 | 20 | protected $attachmentSrcName; // user given attachment base name |
20 | 21 | protected $attachmentPrevName; // user given attachment base name last attempt |
— | — | @@ -23,21 +24,22 @@ |
24 | 25 | |
25 | 26 | public function __construct( User $requester, array $params ) { |
26 | 27 | $this->requester = $requester; |
27 | | - $this->userName = $params['userName']; |
28 | | - $this->realName = $params['realName']; |
| 28 | + $this->userName = trim( $params['userName'] ); |
| 29 | + $this->realName = trim( $params['realName'] ); |
29 | 30 | $this->tosAccepted = $params['tosAccepted']; |
30 | 31 | $this->email = $params['email']; |
31 | | - $this->bio = $params['bio']; |
32 | | - $this->notes = $params['notes']; |
33 | | - $this->urls = $params['urls']; |
| 32 | + $this->bio = trim( $params['bio'] ); |
| 33 | + $this->notes = trim( $params['notes'] ); |
| 34 | + $this->urls = trim( $params['urls'] ); |
34 | 35 | $this->type = $params['type']; |
35 | 36 | $this->areas = $params['areas']; |
| 37 | + $this->ip = $params['ip']; |
| 38 | + $this->registration = wfTimestamp( TS_MW, $params['registration'] ); |
36 | 39 | $this->attachmentPrevName = $params['attachmentPrevName']; |
37 | 40 | $this->attachmentSrcName = $params['attachmentSrcName']; |
38 | 41 | $this->attachmentDidNotForget = $params['attachmentDidNotForget']; |
39 | 42 | $this->attachmentSize = $params['attachmentSize']; |
40 | 43 | $this->attachmentTempPath = $params['attachmentTempPath']; |
41 | | - $this->registration = wfTimestamp( TS_MW, $params['registration'] ); |
42 | 44 | } |
43 | 45 | |
44 | 46 | public function getAttachmentDidNotForget() { |
— | — | @@ -61,8 +63,7 @@ |
62 | 64 | $reqUser = $this->requester; |
63 | 65 | |
64 | 66 | # Now create a dummy user ($u) and check if it is valid |
65 | | - $name = trim( $this->userName ); |
66 | | - if ( $name === '' ) { |
| 67 | + if ( $this->userName === '' ) { |
67 | 68 | return array( 'accountreq_no_name', wfMsgHtml( 'noname' ) ); |
68 | 69 | } |
69 | 70 | $u = User::newFromName( $name, 'creatable' ); |
— | — | @@ -71,7 +72,7 @@ |
72 | 73 | } |
73 | 74 | # No request spamming... |
74 | 75 | if ( $wgAccountRequestThrottle && $reqUser->isPingLimitable() ) { |
75 | | - $key = wfMemcKey( 'acctrequest', 'ip', wfGetIP() ); |
| 76 | + $key = wfMemcKey( 'acctrequest', 'ip', $this->ip ); |
76 | 77 | $value = (int)$wgMemc->get( $key ); |
77 | 78 | if ( $value > $wgAccountRequestThrottle ) { |
78 | 79 | return array( 'accountreq_throttled', |
— | — | @@ -165,8 +166,6 @@ |
166 | 167 | $expires = null; // passed by reference |
167 | 168 | $token = ConfirmAccount::getConfirmationToken( $u, $expires ); |
168 | 169 | |
169 | | - global $wgRequest; |
170 | | - $ip = $wgRequest->getIP(); |
171 | 170 | # Insert into pending requests... |
172 | 171 | $req = UserAccountRequest::newFromArray( array( |
173 | 172 | 'name' => $u->getName(), |
— | — | @@ -185,7 +184,7 @@ |
186 | 185 | 'comment' => '', |
187 | 186 | 'email_token' => md5( $token ), |
188 | 187 | 'email_token_expires' => $expires, |
189 | | - 'ip' => $ip, |
| 188 | + 'ip' => $this->ip, |
190 | 189 | ) ); |
191 | 190 | $dbw->begin(); |
192 | 191 | $req->insertOn(); |
Index: trunk/extensions/ConfirmAccount/presentation/specialpages/actions/RequestAccount_body.php |
— | — | @@ -273,6 +273,7 @@ |
274 | 274 | 'type' => $this->mType, |
275 | 275 | 'areas' => $this->mAreaSet, |
276 | 276 | 'registration' => wfTimestampNow(), |
| 277 | + 'ip' => $this->getRequest()->getIP(), |
277 | 278 | 'attachmentPrevName' => $this->mPrevAttachment, |
278 | 279 | 'attachmentSrcName' => $this->mSrcName, |
279 | 280 | 'attachmentDidNotForget' => $this->mForgotAttachment, // confusing name :) |