* (bug 2943) AuthPlugin::getCanonicalName() name canonicalization hook, patch from...
authorBrion Vibber <brion@users.mediawiki.org>
Sun, 24 Jul 2005 09:48:14 +0000 (09:48 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sun, 24 Jul 2005 09:48:14 +0000 (09:48 +0000)
http://bugzilla.wikimedia.org/show_bug.cgi?id=2943
http://bugzilla.wikimedia.org/attachment.cgi?id=739

RELEASE-NOTES
includes/AuthPlugin.php
includes/User.php

index d7cd826..0a9f083 100644 (file)
@@ -601,6 +601,9 @@ of MediaWiki:Newpagetext) to &action=edit, if page is new.
 * "uselang" and "useskin" URL parameters can now be used in the URL when
   viewing a page, to change the language and skin of a page respectively.
 * Skins can now be previewed in preferences
+* (bug 2943) AuthPlugin::getCanonicalName() name canonicalization hook,
+  patch from robla
+
 
 === Caveats ===
 
index e6572e1..bc15f30 100644 (file)
@@ -210,6 +210,14 @@ class AuthPlugin {
        function initUser( &$user ) {
                # Override this to do something.
        }
+       
+       /**
+        * If you want to munge the case of an account name before the final
+        * check, now is your chance.
+        */
+       function getCanonicalName( $username ) {
+               return $username;
+       }
 }
 
 ?>
index f9e427d..ad537b0 100644 (file)
@@ -64,12 +64,15 @@ class User {
 
                # Reject various classes of invalid names
                $canonicalName = $t->getText();
+               global $wgAuth;
+               $canonicalName = $wgAuth->getCanonicalName( $t->getText() );
+
                if( !User::isValidUserName( $canonicalName ) ) {
                        return null;
                }
 
                $u->setName( $canonicalName );
-               $u->setId( $u->idFromName( $t->getText() ) );
+               $u->setId( $u->idFromName( $canonicalName ) );
                return $u;
        }