upgrade the login code to display errors