From: Brion Vibber Date: Sun, 24 Jul 2005 09:48:14 +0000 (+0000) Subject: * (bug 2943) AuthPlugin::getCanonicalName() name canonicalization hook, patch from... X-Git-Tag: 1.5.0beta4~41 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=e4480a80afb7850b7b6031088c2ea9dc790110f5;p=lhc%2Fweb%2Fwiklou.git * (bug 2943) AuthPlugin::getCanonicalName() name canonicalization hook, patch from robla http://bugzilla.wikimedia.org/show_bug.cgi?id=2943 http://bugzilla.wikimedia.org/attachment.cgi?id=739 --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index d7cd82634c..0a9f083275 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 === diff --git a/includes/AuthPlugin.php b/includes/AuthPlugin.php index e6572e1e35..bc15f30083 100644 --- a/includes/AuthPlugin.php +++ b/includes/AuthPlugin.php @@ -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; + } } ?> diff --git a/includes/User.php b/includes/User.php index f9e427d0f9..ad537b0eeb 100644 --- a/includes/User.php +++ b/includes/User.php @@ -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; }