added cookies to login function