Add $wgReservedUsernames configuration directive to block account creation/use
authorRob Church <robchurch@users.mediawiki.org>
Fri, 14 Apr 2006 21:56:11 +0000 (21:56 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Fri, 14 Apr 2006 21:56:11 +0000 (21:56 +0000)
RELEASE-NOTES
includes/DefaultSettings.php
includes/SpecialUserlogin.php

index 106c518..ad62752 100644 (file)
@@ -71,6 +71,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * installer: show realpath when asking to chmod g+w ./config
 * installer: hide errors returned when trying to dl() mysql.so / pgsql.so
 * installer: cleanly outputbuffer when dieing out
+* Add $wgReservedUsernames configuration directive to block account creation/use
 
 == Compatibility ==
 
index 9c22bd7..f3b8e0b 100644 (file)
@@ -1936,4 +1936,10 @@ $wgAjaxExportList = array( 'wfSajaxSearch' );
  */
 $wgAllowDisplayTitle = false ;
 
+/**
+ * Array of usernames which may not be registered or logged in from
+ * Maintenance scripts can still use these
+ */
+$wgReservedUsernames = array( 'MediaWiki default', 'Conversion script' );
+
 ?>
index 1f6e5a5..f112acd 100644 (file)
@@ -164,7 +164,7 @@ class LoginForm {
                global $wgUser, $wgOut;
                global $wgEnableSorbs, $wgProxyWhitelist;
                global $wgMemc, $wgAccountCreationThrottle, $wgDBname;
-               global $wgAuth, $wgMinimalPasswordLength;
+               global $wgAuth, $wgMinimalPasswordLength, $wgReservedUsernames;
 
                // If the user passes an invalid domain, something is fishy
                if( !$wgAuth->validDomain( $this->mDomain ) ) {
@@ -205,7 +205,7 @@ class LoginForm {
 
                $name = trim( $this->mName );
                $u = User::newFromName( $name );
-               if ( is_null( $u ) || $u->getName() == 'MediaWiki default' ) {
+               if ( is_null( $u ) || in_array( $u->getName(), $wgReservedUsernames ) ) {
                        $this->mainLoginForm( wfMsg( 'noname' ) );
                        return false;
                }
@@ -284,15 +284,14 @@ class LoginForm {
         * @access private
         */
        function processLogin() {
-               global $wgUser;
-               global $wgAuth;
+               global $wgUser, $wgAuth, $wgReservedUsernames;
 
                if ( '' == $this->mName ) {
                        $this->mainLoginForm( wfMsg( 'noname' ) );
                        return;
                }
                $u = User::newFromName( $this->mName );
-               if( is_null( $u ) || $u->getName() == 'MediaWiki default' ) {
+               if( is_null( $u ) || in_array( $u->getName(), $wgReservedUsernames ) ) {
                        $this->mainLoginForm( wfMsg( 'noname' ) );
                        return;
                }