login logic almost complete