Clearer message for range blocks on CreateAccount
authortheopolisme <theopolismewiki@gmail.com>
Sun, 22 Dec 2013 06:05:07 +0000 (00:05 -0600)
committertheopolisme <theopolismewiki@gmail.com>
Sun, 22 Dec 2013 07:25:59 +0000 (01:25 -0600)
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

includes/specials/SpecialUserlogin.php
languages/messages/MessagesEn.php
languages/messages/MessagesQqq.php
maintenance/language/messages.inc

index b9a84be..d071e75 100644 (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
                );
        }
 
index e815995..f645531 100644 (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''",
index 4fc329a..803067e 100644 (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',
index 662c3d3..5e463b2 100644 (file)
@@ -800,6 +800,7 @@ $wgMessageStructure = array(
        'cantcreateaccount' => array(
                'cantcreateaccounttitle',
                'cantcreateaccount-text',
+               'cantcreateaccount-range-text',
        ),
        'history' => array(
                'viewpagelogs',