login logic and errors