added the login logic