Clearer message for range blocks on CreateAccount

If a user tries to create an account but their
IP address is part of a range block, this will
be reflected in the error that is displayed via
the cantcreateaccount-range-text message.

Bug: 35090
Change-Id: I74e912755dea93c2b74e67d7104b7525298051c0
This commit is contained in:
theopolisme 2013-12-22 00:05:07 -06:00
parent eb372b5321
commit e352a54f5f
4 changed files with 24 additions and 6 deletions

View file

@ -980,14 +980,23 @@ class LoginForm extends SpecialPage {
# haven't bothered to log out before trying to create an account to
# evade it, but we'll leave that to their guilty conscience to figure
# out.
$errorParams = array(
$block->getTarget(),
$block->mReason ? $block->mReason : $this->msg( 'blockednoreason' )->text(),
$block->getByName()
);
if ( $block->getType() === Block::TYPE_RANGE ) {
$errorMessage = 'cantcreateaccount-range-text';
$errorParams[] = $this->getRequest()->getIP();
} else {
$errorMessage = 'cantcreateaccount-text';
}
throw new ErrorPageError(
'cantcreateaccounttitle',
'cantcreateaccount-text',
array(
$block->getTarget(),
$block->mReason ? $block->mReason : $this->msg( 'blockednoreason' )->text(),
$block->getByName()
)
$errorMessage,
$errorParams
);
}

View file

@ -1615,6 +1615,9 @@ Please check the comparison below to verify that this is what you want to do, an
# Account creation failure
'cantcreateaccounttitle' => 'Cannot create account',
'cantcreateaccount-range-text' => "Account creation from IP addresses in the range '''$1''', which includes your IP address ('''$4'''), has been blocked by [[User:$3|$3]].
The reason given by $3 is ''$2''",
'cantcreateaccount-text' => "Account creation from this IP address ('''$1''') has been blocked by [[User:$3|$3]].
The reason given by $3 is ''$2''",

View file

@ -2266,6 +2266,11 @@ See also:
* $1 - target IP address
* $2 - reason or {{msg-mw|blockednoreason}}
* $3 - username',
'cantcreateaccount-range-text' => "Used as more detailed version of the {{msg-mw|Cantcreateaccount-text}} error message, with the title {{msg-mw|cantcreateaccounttitle}}.
* $1 - target IP range
* $2 - reason or {{msg-mw|blockednoreason}}
* $3 - username
* $4 - current user's IP address",
# History pages
'viewpagelogs' => 'Link displayed in history of pages',

View file

@ -800,6 +800,7 @@ $wgMessageStructure = array(
'cantcreateaccount' => array(
'cantcreateaccounttitle',
'cantcreateaccount-text',
'cantcreateaccount-range-text',
),
'history' => array(
'viewpagelogs',