Added more error handling to the login form.