Friday, December 2, 2011

Streamlined Login for MediaWiki

I love MediaWiki overall, but I cannot stand the way the login prompt works when an unauthenticated user tries to access a protected page.

The tedious process is basically as follows:
  1. User clicks a link to a protected page. A page with "duh" instructions is displayed, forcing the user to click a link to get to a login form.
  2. User clicks the link to get to the login form. Why doesn't the login form automatically give focus to the Username field?
  3. User clicks in the Username field just to start typing in a username.

The process really should be as follows:
  1. User clicks a link to a protected page.
  2. User immediately starts typing a username.

So, to make it easier for users to like and adopt our MediaWiki instance, I customized two files: /includes/OutputPage.php and /includes/templates/Userlogin.php.

In case anyone wants to easily copy the code, I've uploaded my notes on this hack. Now I'm finally ready to start publicizing our MediaWiki internally and getting people excited about it!

This hack was tested on the following browsers in Mac OS X Lion:
  • Safari 5.1.1
  • Firefox 8.0.1
  • Chrome 15.0

Note: This implementation causes the instructions page to fully load before JavaScript redirects the user to the actual login page. Any suggestions on how to skip the loading of the instructions page altogether will be much appreciated.

Note: grep -R alone is a significant reason why Linux- and Unix-based OS's (e.g., Mac) are so much better for developers than Windows, out of the box.