added error handling to login form