Changed login to use cookies