Updated Error Handling for Login