r13646 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r13645‎ | r13646 | r13647 >
Date:21:56, 14 April 2006
Author:robchurch
Status:old
Tags:
Comment:
Add $wgReservedUsernames configuration directive to block account creation/use
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/SpecialUserlogin.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialUserlogin.php
@@ -164,7 +164,7 @@
165165 global $wgUser, $wgOut;
166166 global $wgEnableSorbs, $wgProxyWhitelist;
167167 global $wgMemc, $wgAccountCreationThrottle, $wgDBname;
168 - global $wgAuth, $wgMinimalPasswordLength;
 168+ global $wgAuth, $wgMinimalPasswordLength, $wgReservedUsernames;
169169
170170 // If the user passes an invalid domain, something is fishy
171171 if( !$wgAuth->validDomain( $this->mDomain ) ) {
@@ -205,7 +205,7 @@
206206
207207 $name = trim( $this->mName );
208208 $u = User::newFromName( $name );
209 - if ( is_null( $u ) || $u->getName() == 'MediaWiki default' ) {
 209+ if ( is_null( $u ) || in_array( $u->getName(), $wgReservedUsernames ) ) {
210210 $this->mainLoginForm( wfMsg( 'noname' ) );
211211 return false;
212212 }
@@ -284,15 +284,14 @@
285285 * @access private
286286 */
287287 function processLogin() {
288 - global $wgUser;
289 - global $wgAuth;
 288+ global $wgUser, $wgAuth, $wgReservedUsernames;
290289
291290 if ( '' == $this->mName ) {
292291 $this->mainLoginForm( wfMsg( 'noname' ) );
293292 return;
294293 }
295294 $u = User::newFromName( $this->mName );
296 - if( is_null( $u ) || $u->getName() == 'MediaWiki default' ) {
 295+ if( is_null( $u ) || in_array( $u->getName(), $wgReservedUsernames ) ) {
297296 $this->mainLoginForm( wfMsg( 'noname' ) );
298297 return;
299298 }
Index: trunk/phase3/includes/DefaultSettings.php
@@ -1936,4 +1936,10 @@
19371937 */
19381938 $wgAllowDisplayTitle = false ;
19391939
 1940+/**
 1941+ * Array of usernames which may not be registered or logged in from
 1942+ * Maintenance scripts can still use these
 1943+ */
 1944+$wgReservedUsernames = array( 'MediaWiki default', 'Conversion script' );
 1945+
19401946 ?>
Index: trunk/phase3/RELEASE-NOTES
@@ -71,6 +71,7 @@
7272 * installer: show realpath when asking to chmod g+w ./config
7373 * installer: hide errors returned when trying to dl() mysql.so / pgsql.so
7474 * installer: cleanly outputbuffer when dieing out
 75+* Add $wgReservedUsernames configuration directive to block account creation/use
7576
7677 == Compatibility ==
7778

Status & tagging log