finished sign in logic with tests