Index: trunk/extensions/ConfirmAccount/SpecialConfirmAccount.php |
— | — | @@ -23,13 +23,13 @@ |
24 | 24 | $wgMakeUserPageFromBio = true;
|
25 | 25 | $wgSaveRejectedAccountReqs = true;
|
26 | 26 | $wgRejectedAccountMaxAge = 7 * 24 * 3600; // One week
|
| 27 | +# How many requests can an IP make at once?
|
| 28 | +$wgAccountRequestThrottle = 1;
|
27 | 29 |
|
28 | 30 | $wgGroupPermissions['*']['createaccount'] = false;
|
29 | 31 | $wgGroupPermissions['sysop']['createaccount'] = false;
|
30 | 32 | $wgGroupPermissions['bureaucrat']['confirmaccount'] = true;
|
31 | 33 |
|
32 | | -$wgAccountRequestThrottle = 1;
|
33 | | -
|
34 | 34 | # Internationalisation
|
35 | 35 | require_once( 'ConfirmAccount.i18n.php' );
|
36 | 36 |
|
— | — | @@ -57,7 +57,7 @@ |
58 | 58 | $dup = $dbw->selectField( 'account_requests', '1',
|
59 | 59 | array( 'acr_name' => $user->getName() ),
|
60 | 60 | __METHOD__ );
|
61 | | -
|
| 61 | +
|
62 | 62 | if ( $dup ) {
|
63 | 63 | $abortError = wfMsgHtml('requestaccount-inuse');
|
64 | 64 | }
|
Index: trunk/extensions/ConfirmAccount/ConfirmAccount.sql |
— | — | @@ -40,6 +40,8 @@ |
41 | 41 | acr_registration char(14) NOT NULL,
|
42 | 42 | -- Flag for rejected requests
|
43 | 43 | acr_rejected bool NOT NULL,
|
| 44 | + -- The user who rejected it
|
| 45 | + acr_user int unsigned NOT NULL default 0,
|
44 | 46 |
|
45 | 47 | PRIMARY KEY (acr_id),
|
46 | 48 | UNIQUE KEY (acr_name),
|
Index: trunk/extensions/ConfirmAccount/ConfirmAccount.pg.sql |
— | — | @@ -8,7 +8,7 @@ |
9 | 9 | CREATE SEQUENCE account_requests_acr_id_seq;
|
10 | 10 | CREATE TABLE account_requests (
|
11 | 11 | acr_id INTEGER NOT NULL DEFAULT nextval('account_requests_acr_id_seq'),
|
12 | | - acr_name TEXT NOT NULL UNIQUE,
|
| 12 | + acr_name TEXT NOT NULL UNIQUE,
|
13 | 13 | acr_real_name TEXT,
|
14 | 14 | acr_email TEXT,
|
15 | 15 | acr_email_token CHAR(32),
|
— | — | @@ -20,6 +20,7 @@ |
21 | 21 | acr_url TEXT,
|
22 | 22 | acr_ip CIDR,
|
23 | 23 | acr_rejected BOOL NOT NULL,
|
| 24 | + acr_user INTEGER REFERENCES mwuser(user_id) ON DELETE SET NULL,
|
24 | 25 | );
|
25 | 26 |
|
26 | 27 | CREATE INDEX acr_rejected_reg ON account_requests (acr_rejected,acr_registration),
|
Index: trunk/extensions/ConfirmAccount/ConfirmAccount_body.php |
— | — | @@ -385,24 +385,28 @@ |
386 | 386 | }
|
387 | 387 |
|
388 | 388 | if( $action == 'reject' ) {
|
| 389 | + global $wgSaveRejectedAccountReqs;
|
389 | 390 | # Make proxy user to email a rejection message :(
|
390 | 391 | $u = User::newFromName( $row->acr_name, 'creatable' );
|
391 | 392 | $u->setEmail( $row->acr_email );
|
392 | | - $result = $u->sendMail( wfMsg( 'confirmaccount-email-subj' ),
|
393 | | - wfMsg( 'confirmaccount-email-body2', $u->getName() ) );
|
394 | | - if( WikiError::isError( $result ) ) {
|
395 | | - $error = wfMsg( 'mailerror', htmlspecialchars( $result->getMessage() ) );
|
396 | | - $this->showForm( $error );
|
397 | | - return false;
|
| 393 | + # Do not send multiple times
|
| 394 | + if( !$row->acr_rejected ) {
|
| 395 | + $result = $u->sendMail( wfMsg( 'confirmaccount-email-subj' ),
|
| 396 | + wfMsg( 'confirmaccount-email-body2', $u->getName() ) );
|
| 397 | + if( WikiError::isError( $result ) ) {
|
| 398 | + $error = wfMsg( 'mailerror', htmlspecialchars( $result->getMessage() ) );
|
| 399 | + $this->showForm( $error );
|
| 400 | + return false;
|
| 401 | + }
|
398 | 402 | }
|
399 | | -
|
400 | 403 | $dbw = wfGetDB( DB_MASTER );
|
401 | 404 | # Either mark off the row as deleted or wipe it completely
|
402 | | - global $wgSaveRejectedAccountReqs;
|
403 | 405 | if( $wgSaveRejectedAccountReqs ) {
|
| 406 | + global $wgUser;
|
404 | 407 | # Request can later be recovered
|
405 | | - $dbw->update( 'account_requests', array('acr_rejected' => 1),
|
406 | | - array('acr_id' => $this->acrID),
|
| 408 | + $dbw->update( 'account_requests',
|
| 409 | + array( 'acr_rejected' => 1, 'acr_user' => $wgUser->getID() ),
|
| 410 | + array( 'acr_id' => $this->acrID ),
|
407 | 411 | __METHOD__ );
|
408 | 412 | } else {
|
409 | 413 | $dbw->delete( 'account_requests', array('acr_id' => $this->acrID), __METHOD__ );
|
— | — | @@ -566,7 +570,7 @@ |
567 | 571 | if( $action == 'accept' )
|
568 | 572 | $wgOut->addWikiText( wfMsg( "confirmaccount-acc", $name ) );
|
569 | 573 | else
|
570 | | - $wgOut->addWikiText( wfMsg( "confirmaccount-del" ) );
|
| 574 | + $wgOut->addWikiText( wfMsg( "confirmaccount-rej" ) );
|
571 | 575 |
|
572 | 576 | $wgOut->returnToMain( true, $wgTitle );
|
573 | 577 | }
|
— | — | @@ -624,8 +628,10 @@ |
625 | 629 | $time = $wgLang->timeanddate( wfTimestamp(TS_MW, $row->acr_registration), true );
|
626 | 630 |
|
627 | 631 | $r = '<li>';
|
628 | | - $r .= $time." ($link)".'<br/>';
|
629 | | - $r .= '<table cellspacing=\'1\' cellpadding=\'3\' border=\'1\' width=\'100%\'>';
|
| 632 | + $r .= $time." ($link)";
|
| 633 | + if( $this->showRejects )
|
| 634 | + $r .= ' <strong>'.wfMsgExt( 'confirmaccount-reject', array('parseinline'), $row->user_name ).'</strong>';
|
| 635 | + $r .= '<br/><table cellspacing=\'1\' cellpadding=\'3\' border=\'1\' width=\'100%\'>';
|
630 | 636 | $r .= '<tr><td><strong>'.wfMsg('confirmaccount-name').'</strong></td><td width=\'100%\'>' .
|
631 | 637 | htmlspecialchars($row->acr_name) . '</td></tr>';
|
632 | 638 | $r .= '<tr><td><strong>'.wfMsg('confirmaccount-real').'</strong></td><td width=\'100%\'>' .
|
— | — | @@ -667,10 +673,12 @@ |
668 | 674 |
|
669 | 675 | function getQueryInfo() {
|
670 | 676 | $conds = $this->mConds;
|
| 677 | + $conds[] = 'acr_user = user_id';
|
| 678 | +
|
671 | 679 | return array(
|
672 | | - 'tables' => array('account_requests'),
|
| 680 | + 'tables' => array('account_requests','user'),
|
673 | 681 | 'fields' => 'acr_id,acr_name,acr_real_name,acr_registration,acr_email,acr_email_authenticated,
|
674 | | - acr_bio,acr_notes,acr_urls',
|
| 682 | + acr_bio,acr_notes,acr_urls,acr_user,user_name',
|
675 | 683 | 'conds' => $conds
|
676 | 684 | );
|
677 | 685 | }
|
Index: trunk/extensions/ConfirmAccount/ConfirmAccount.i18n.php |
— | — | @@ -73,10 +73,11 @@ |
74 | 74 | 'confirmaccount-review' => 'Approve/Reject',
|
75 | 75 | 'confirmacount-confirm' => 'Use the buttons below to irreversibly confirm this request and create the account or deny it.',
|
76 | 76 | 'confirmaccount-econf' => '(confirmed)',
|
| 77 | + 'confirmaccount-reject' => '(rejected by [[User:$1|$1]])',
|
77 | 78 | 'confirmacount-create' => 'Confirm (create account)',
|
78 | 79 | 'confirmacount-deny' => 'Reject',
|
79 | 80 | 'confirmaccount-acc' => 'Account request confirmed successfully; created new user account [[User:$1]].',
|
80 | | - 'confirmaccount-del' => 'Account request rejected and successfully deleted.',
|
| 81 | + 'confirmaccount-rej' => 'Account request rejected successfully.',
|
81 | 82 | 'confirmaccount-summary' => 'Creating user page with biography of new user.',
|
82 | 83 | 'confirmaccount-email-subj' => '{{SITENAME}} account request',
|
83 | 84 | 'confirmaccount-email-body' => 'Your request for an account has been approved on {{SITENAME}}.
|