Added error-checking for login credentials.