updated invalid login to check for error before login has occurred