Index: trunk/extensions/ConfirmAccount/frontend/specialpages/actions/RequestAccount_body.php |
— | — | @@ -24,18 +24,15 @@ |
25 | 25 | |
26 | 26 | function execute( $par ) { |
27 | 27 | global $wgUseRealNamesOnly, $wgAccountRequestToS, $wgAccountRequestExtraInfo; |
28 | | - global $wgAccountRequestTypes, $wgAccountRequestWhileBlocked; |
| 28 | + global $wgAccountRequestTypes; |
29 | 29 | |
30 | 30 | $reqUser = $this->getUser(); |
31 | 31 | $request = $this->getRequest(); |
32 | 32 | |
33 | | - # If a user cannot make accounts, don't let them request them either |
34 | | - if ( !$wgAccountRequestWhileBlocked ) { |
35 | | - if ( ( $block = $reqUser->isBlockedFromCreateAccount() ) ) { |
36 | | - throw new UserBlockedError( $block ); |
37 | | - } |
38 | | - } |
39 | | - if ( wfReadOnly() ) { |
| 33 | + $block = ConfirmAccount::getAccountRequestBlock( $reqUser ); |
| 34 | + if ( $block ) { |
| 35 | + throw new UserBlockedError( $block ); |
| 36 | + } elseif ( wfReadOnly() ) { |
40 | 37 | throw new ReadOnlyError(); |
41 | 38 | } |
42 | 39 | |
Index: trunk/extensions/ConfirmAccount/frontend/language/ConfirmAccountPage.i18n.php |
— | — | @@ -73,7 +73,7 @@ |
74 | 74 | 'confirmaccount-notes' => 'Additional notes:', |
75 | 75 | 'confirmaccount-urls' => 'List of websites:', |
76 | 76 | 'confirmaccount-none-p' => '(not provided)', |
77 | | - 'confirmaccount-confirm' => 'Use the options below to accept, deny, or hold this request:', |
| 77 | + 'confirmaccount-confirm' => 'Use the options below to accept, reject, or hold this request:', |
78 | 78 | 'confirmaccount-econf' => '(confirmed)', |
79 | 79 | 'confirmaccount-reject' => '(rejected by [[User:$1|$1]] on $2)', |
80 | 80 | 'confirmaccount-rational' => 'Rationale given to applicant:', |
— | — | @@ -90,7 +90,7 @@ |
91 | 91 | 'confirmaccount-submit' => 'Confirm', |
92 | 92 | 'confirmaccount-needreason' => 'You must provide a reason in the comment box below.', |
93 | 93 | 'confirmaccount-canthold' => 'This request is already either on hold or deleted.', |
94 | | - 'confirmaccount-badaction' => 'An valid action (accept,reject,hold) must be specified in order to proceed.', |
| 94 | + 'confirmaccount-badaction' => 'An valid action (accept, reject, hold) must be specified in order to proceed.', |
95 | 95 | 'confirmaccount-acc' => 'Account request confirmed successfully; |
96 | 96 | created new user account [[User:$1|$1]].', |
97 | 97 | 'confirmaccount-rej' => 'Account request rejected successfully.', |
Index: trunk/extensions/ConfirmAccount/backend/ConfirmAccount.class.php |
— | — | @@ -287,4 +287,21 @@ |
288 | 288 | } |
289 | 289 | return $res; |
290 | 290 | } |
| 291 | + |
| 292 | + /** |
| 293 | + * Get a block for this user if they are blocked from requesting accounts |
| 294 | + * @param User $user |
| 295 | + * @return Block|null |
| 296 | + */ |
| 297 | + public static function getAccountRequestBlock( User $user ) { |
| 298 | + global $wgAccountRequestWhileBlocked; |
| 299 | + |
| 300 | + $block = false; |
| 301 | + # If a user cannot make accounts, don't let them request them either |
| 302 | + if ( !$wgAccountRequestWhileBlocked ) { |
| 303 | + $block = $user->isBlockedFromCreateAccount(); |
| 304 | + } |
| 305 | + |
| 306 | + return $block; |
| 307 | + } |
291 | 308 | } |
Index: trunk/extensions/ConfirmAccount/business/AccountRequestSubmission.php |
— | — | @@ -65,8 +65,17 @@ |
66 | 66 | public function submit( IContextSource $context ) { |
67 | 67 | global $wgAuth, $wgAccountRequestThrottle, $wgMemc, $wgContLang; |
68 | 68 | global $wgAccountRequestToS, $wgAccountRequestMinWords; |
| 69 | + |
69 | 70 | $reqUser = $this->requester; |
70 | 71 | |
| 72 | + # Make sure that basic permissions are checked |
| 73 | + $block = ConfirmAccount::getAccountRequestBlock( $reqUser ); |
| 74 | + if ( $block ) { |
| 75 | + return array( 'accountreq_permission_denied', wfMsgHtml( 'badaccess-group0' ) ); |
| 76 | + } elseif ( wfReadOnly() ) { |
| 77 | + return array( 'accountreq_readonly', wfMsgHtml( 'badaccess-group0' ) ); |
| 78 | + } |
| 79 | + |
71 | 80 | # Now create a dummy user ($u) and check if it is valid |
72 | 81 | if ( $this->userName === '' ) { |
73 | 82 | return array( 'accountreq_no_name', wfMsgHtml( 'noname' ) ); |
Index: trunk/extensions/ConfirmAccount/business/AccountConfirmSubmission.php |
— | — | @@ -32,6 +32,12 @@ |
33 | 33 | * @return array( true or error key string, html error msg or null ) |
34 | 34 | */ |
35 | 35 | public function submit( IContextSource $context ) { |
| 36 | + # Make sure that basic permissions are checked |
| 37 | + if ( !$this->admin->getID() || !$this->admin->isAllowed( 'confirmaccount' ) ) { |
| 38 | + return array( 'accountconf_permission_denied', wfMsgHtml( 'badaccess-group0' ) ); |
| 39 | + } elseif ( wfReadOnly() ) { |
| 40 | + return array( 'accountconf_readonly', wfMsgHtml( 'badaccess-group0' ) ); |
| 41 | + } |
36 | 42 | if ( $this->action === 'spam' ) { |
37 | 43 | return $this->spamRequest( $context ); |
38 | 44 | } elseif ( $this->action === 'reject' ) { |
— | — | @@ -70,18 +76,16 @@ |
71 | 77 | $u->setEmail( $this->accountReq->getEmail() ); |
72 | 78 | # Send out a rejection email... |
73 | 79 | if ( $this->reason != '' ) { |
74 | | - $result = $u->sendMail( |
75 | | - wfMsgForContent( 'confirmaccount-email-subj' ), |
76 | | - wfMsgExt( 'confirmaccount-email-body4', |
77 | | - array( 'parsemag', 'content' ), $u->getName(), $this->reason ) |
78 | | - ); |
79 | | - } else { // no reason given |
80 | | - $result = $u->sendMail( |
81 | | - wfMsgForContent( 'confirmaccount-email-subj' ), |
82 | | - wfMsgExt( 'confirmaccount-email-body3', |
83 | | - array( 'parsemag', 'content' ), $u->getName() ) |
84 | | - ); |
| 80 | + $emailBody = wfMsgExt( 'confirmaccount-email-body4', |
| 81 | + array( 'parsemag', 'content' ), $u->getName(), $this->reason ); |
| 82 | + } else { |
| 83 | + $emailBody = wfMsgExt( 'confirmaccount-email-body3', |
| 84 | + array( 'parsemag', 'content' ), $u->getName() ); |
85 | 85 | } |
| 86 | + $result = $u->sendMail( |
| 87 | + wfMsgForContent( 'confirmaccount-email-subj' ), |
| 88 | + $emailBody |
| 89 | + ); |
86 | 90 | if ( !$result->isOk() ) { |
87 | 91 | $dbw->rollback(); |
88 | 92 | return array( 'accountconf_mailerror', |
— | — | @@ -200,7 +204,7 @@ |
201 | 205 | # DELETE new rows in case there was a COMMIT somewhere |
202 | 206 | $this->acceptRequest_rollback( $dbw, $user->getId(), $acd_id ); |
203 | 207 | return array( 'accountconf_copyfailed', |
204 | | - $context->getOutput()->parse( $result->getWikiText() ) ); |
| 208 | + $context->getOutput()->parse( $status->getWikiText() ) ); |
205 | 209 | } |
206 | 210 | } |
207 | 211 | $acd_id = $dbw->nextSequenceValue( 'account_credentials_acd_id_seq' ); |