(bug 38333) Check global blocks on account create
authorcsteipp <csteipp@wikimedia.org>
Fri, 20 Jul 2012 18:54:14 +0000 (11:54 -0700)
committerReedy <reedy@wikimedia.org>
Mon, 23 Jul 2012 20:17:25 +0000 (21:17 +0100)
Before displaying an account creation form, checks against
GlobalBlocking are run, but not when the actual account is
created.

At this time, User::isBlockedFromCreateAccount() does not
run the hooks for which GlobalBlocking is registered.

Change-Id: Ieb3696bc49d6f4c4e3e95d8c55121b7ffa07b506

includes/specials/SpecialUserlogin.php

index 613e3b9..adda68c 100644 (file)
@@ -331,6 +331,12 @@ class LoginForm extends SpecialPage {
                        return false;
                }
 
+               # Include checks that will include GlobalBlocking (Bug 38333)
+               $permErrors = $this->getTitle()->getUserPermissionsErrors( 'createaccount', $currentUser, true );
+               if ( count( $permErrors ) ) {
+                               throw new PermissionsError( 'createaccount', $permErrors );
+               }
+
                $ip = $this->getRequest()->getIP();
                if ( $currentUser->isDnsBlacklisted( $ip, true /* check $wgProxyWhitelist */ ) ) {
                        $this->mainLoginForm( $this->msg( 'sorbs_create_account_reason' )->text() . ' ' . $this->msg( 'parentheses', $ip )->escaped() );