I've been looking into some UX issues this week, and various other front end components to make a client's site more aesthetically pleasing, which is always fun.
Now, I won't lie.. I also use Wordpress as a blogging platform.. yeah yeah, a ColdFusion developer using a PHP application. The truth is, I've used it from day one as a blogger (I've been doing this in various forms for the last 6 years, believe it or not), and it's constantly being updated. It's a great system with some fantastic developers behind it, as well as a very clean design principle.
Now, logging into a Wordpress blog the other day I mixed up my password with one of the million or so that I use (couple that with the fact I'm getting old and forgetful...) and I received a really pleasant surprise from Wordpress (version 3).
After the failed login, the entire login form shook a few times, and displayed above it is the error information box. That was a really nice addition; they could have just stuck with the traditional big red "YOU MESSED UP, YOU IDIOT" message you see on so many sites.
This reminded me of something else; One of the presentations I was able to escape long enough to attend at Scotch on the Rocks 2011 was one from Aral Balkan, title "The Art of Emotional Design: a story of pleasure, joy, and delight". A fantastic presentation, and one which really makes you think about developing or adding details in to your applications to make your users go "oooh" instead of "oh.."
...which is what happened here (which is a good thing).
Shake what you got
Instantly I wanted to emulate it and create something similar. Wordpress is packed with classes and action hooks to load in specific actions when required.
To create a very simple equivalent, I'm using the very powerful jQuery UI library, which has a shake effect baked in - awesome.
You can view the video using the link at the top of this post, or watch it directly on YouTube.
Here's the core of the login form created for the demo:
Nothing out of the ordinary going on here.. in fact the WHOLE process is incredibly simple. In this example, we're just sending through username and password parameters, and are validating against a fixed authentication; I'm not querying a database in this instance.
The authentication process returns a boolean value, which we'll use in the jQuery handling to determine succes (or not).
<!--- Name: checkLogin.cfm Author: Matt Gifford aka coldfumonkeh Date: 11/08/2010 Purpose: Dummy login authentication page checking against static information. ---> <cfsetting enablecfoutputonly="true" showdebugoutput="false" /> <cfparam name="boolSuccess" type="boolean" default="false" /> <cfif structKeyExists(form, 'username') AND structKeyExists(form, 'password')> <cfif form.username EQ 'random1000' AND form.password EQ 'password'> <cfset boolSuccess = true /> </cfif> </cfif> <cfoutput>#boolSuccess#</cfoutput>
The actual core of the work is within the jQuery script, which in itself is still pretty straightforward.
In the example below, we're using jQuery's AJAX method to send the form and it's data to the checkLogin.cfm page.
Using the boolean response as a status to monitor the authentication success, we can then handle the form and any processes that we need to take care of:
index.cfm (jQuery code)
Using jQuery's UI, we are able to not only set the shake effect and apply it to the entire loginForm div element, we are also able to set the class attributes for the login_message element and apply the styles from the CSS themes available with the UI framework.
Shake it yourself
The only true way to enjoy is to experience yourself. :)
The full code for this example is available to download.