Sometime ago I decided that I wanted to do some web stuff that was user based, where you could sign up with just an email and password, and if you were new to the site, you would have to agree to terms. This would make it so that the signup form and the login form could be nearly identical. All the same except that darn agree to terms checkbox.
Tonight, I made the form on the front page of hs a little smarter and ajax, as above, smoothed the edges. I used to do some javascript validation for the iagree checkbox, but I got rid of that, and via ajax I submit the username and password. There are three cases
- username is taken, password is right – ding! let’s send back an auth, and who cares if they clicked iagree
- username is taken, password is wrong – get a wrong password error
- username is available, but did not agree to terms – get a javascript alert saying you have to agree
It is all pretty well seamless, and right now it is sure darn quick, so there you go. New or old can login / register via the front page and would not likely realize all the coolness that had just happened.