On Sat, 2005-07-23 at 11:10 +0200, Brion Vibber wrote:
Rob Lanphier wrote:
However, I log back out and log back in as "RoBLA". It allows this too. Yay? Looking at the user db, it appears to have auto-created accounts for "RobLa" and "RoBLA". Boo!
My inclination is to add a new method AuthPlugin::getCanonicalName($username), which gets called from User::newFromName. That'll give my plugin (or any AuthPlugin) a crack at munging the name just before an account is created.
You should be able to modify the name on the user object as it's passed through to you to use the canonical case form.
I don't believe that the user object is getting properly passed through at a time that it does any good. Most of the current interfaces pass copies of the "username" string up until the point where there's a verified account (too late). AuthPlugin::initUser is the first crack I get at a user object that's been explicitly passed through, which is too late.
So, my options appear to be: 1. (my current approach) add call to AuthPlugin::setCanonicalName in User::newFromName. I coded this last night, and it seems to work pretty well, but does require a patch. 2. Try munging a global, such as $wgUser, in AuthPlugin::authenticate. I haven't yet worked out if that'll actually do the trick, since it appears that the mName member of LoginForm object is the name that is being used right up until account creation, and I don't think AuthPlugin has access to it (as a global, by passed-in reference, or otherwise). Regardless, I'm assuming that munging globals from plugins is bad behavior that'll eventually break. That said, I much prefer a solution that won't require a patch, so I'm willing to go that route for 1.5.
I'm assuming that getting a patch included in the mainline 1.5 release is pretty tough at this point, which is fine. I'm hoping to target a patch for the release after, if we agree that one is needed for clean integration. In the meantime, I'll work around the issue for 1.5.
I've included the patch thus far, which is against CVS head.
Rob