Topic on Project:Support desk

Jump to navigation Jump to search

Extension:ConfirmAccount Does Not Remove User After Rejection

7
Summary by Johnywhy

2 steps:

  • Set rejected items to expire immediately (in LocalSettings.php)
  • Prune rejected items at beginning of Request action (in RequestAccount_body.php)
Johnywhy (talkcontribs)

Installed and confirmed basic usage of extension. https://www.mediawiki.org/wiki/Extension:ConfirmAccount

But, after Admin rejected an account request, the same username/email could not submit another request.

Received:

Username is already in use in a pending account request.

Any fix? thx

Ciencia Al Poder (talkcontribs)

The page says, in the Known Issues section: If only a few people view the confirm accounts page, the randomly triggered pruning of old requests will not trigger often, so old rejected requests may persist.

Johnywhy (talkcontribs)

Thx for catching that. It seems the quote you shared isn't precisely correct. I found the following in \ConfirmAccount\frontend\specialpages\actions\ConfirmAccount_body.php

# Every 30th view, prune old deleted items

if ( 0 == mt_rand( 0, 29 ) ) {

ConfirmAccount::runAutoMaintenance();

}


Maybe i can force prune on every rejection? The function `runAutoMaintenance` lives in \ConfirmAccount\backend\ConfirmAccount.class.php

class ConfirmAccount {

/** * Move old stale requests to rejected list. Delete old rejected requests. */

public static function runAutoMaintenance() {...

thx

50.201.56.82 (talkcontribs)
Johnywhy (talkcontribs)

Since this is not MW core, it seems the Archtecture meeting isn't the appropriate place to discuss.

Instead, i contacted the extension author. Thread:

Topic:U9pxcbiec7durjip

Johnywhy (talkcontribs)
Johnywhy (talkcontribs)

looks like i solved it. There are 2 steps:

  • Set rejected items to expire immediately (LocalSettings.php)
  • Prune rejected items at beginning of Request action (RequestAccount_body.php)

Details:

In LocalSettings.php, after required declaration, set Rejected-Age to 0. That ensures rejected requests will be removed on prune-action:

require_once "$IP/extensions/ConfirmAccount/ConfirmAccount.php";
$wgRejectedAccountMaxAge = 0;

Add Prune code to the function that shows the Request form:

in /ConfirmAccount/frontend/specialpages/actions/RequestAccount_body.php, function showForm, add very last command in the function:

old code:

$out->addWikiMsg( 'requestaccount-footer' );
}

new code:

$out->addWikiMsg( 'requestaccount-footer' );		
# PRUNE
ConfirmAccount::runAutoMaintenance();
}