refactored User Login and Cookies