Hi Tim,
Thanks for the feedback. Since Brion incorporated my patch (thanks
Brion!), I've got a lot of flexibility in how to approach this,
including the approach that you suggest.
I'm to the point where we should take the conversation to the
MediaWiki/WordPress integration list, since they are the customers of
this feature:
http://lists.automattic.com/mailman/listinfo/wiki-tech
Please direct follow-ups to that list instead of wikitech-l.
For those just joining us, here's the thread so far:
http://mail.wikipedia.org/pipermail/wikitech-l/2005-July/thread.html#30861
Comments inline:
On Sun, 2005-07-24 at 11:32 +0100, Timwi wrote:
Rob Lanphier wrote:
I'm in the process of writing a AuthPlugin
for bbPress, so that the
WordPress folks can do single sign-on between their user forums and
their MediaWiki install. First release is here:
http://codex.wordpress.org/User:RobLa/bbPress_Auth_for_MediaWiki
One thing I'm having trouble with is the case sensitivity issue.
bbPress isn't case sensitive. MediaWiki is. This makes logging in
relatively simple. As it turns out, I accidentally leveraged SQLs
default case-insensitivity in my first crack at this.
I've thought about this issue before (when a friend asked me if one
could make article titles entirely case-insensitive).
Personally, I believe the best approach would be the following. Have all
the names (article titles in the 'page' table in his case, usernames in
the 'user' table in your case) be entirely lower-case and define that as
the "canonical form". Then when someone tries to log in as "RobLA" it
will search for "robla" and find it.
Then add another column to that table, 'displayname' or something, which
contains the username with the capitalisation the user prefers. In
Recent Changes, Watchlists, Histories, everything where a username is
shown, you use that, but in URLs you use the lower-case form.
Here's how I'm solving it for now. I'm letting the user use whatever
case they want for their first login. So, if "robla" signs in as
"RobLa" on the first time, a new MediaWiki user table entry with
"RobLa"
in the user_name field is created.
On the second and subsequent tries, the login portion isn't case
sensitive. So, I can still log in as "robla" or "RoBlA", and
it'll
blissfully accept it (passwords are another story, always case sensitive
as they should be). However, when AuthPlugin::getCanonicalName is
called, it'll return the first (and presumably only) instance of "robla"
in the /MediaWiki/ database, by making this call:
$res = $dbr->selectRow('user',
array("user_name"),
"lower(user_name)=lower(".
$dbr->addQuotes($username).")",
"AuthBBPress::getCanonicalName" );
Thus, if "RobLa" was what I used the first time, it'll show that I'm
logged in as "RobLa" now, regardless of what case I filled in subsequent
login attempts.
This works particularly well for folks that are migrating to single
sign-on, since this works for whatever case was chosen in the legacy
accounts, while still making it possible to only have one representation
of that combination of letters.
It's not a perfect scheme. People probably won't realize just how
important it is that the first login attempt use the case combo that
they want to live with. In fact, just to avoid MediaWiki problems, I'm
leaving the automatic first letter transition of "robla" to "Robla"
intact. However, there doesn't seem to be any sense in making a
preference or a new database entry, since the case of login names in
MediaWiki isn't easily mutable once created.
The very nice part about this is that there are now no further patches
to MediaWiki required. A stock MediaWiki 1.5 install will work out of
the box
Rob