added some login database logic. Still need to code getLoginState()