added common code for users and logins
added login code