I've noticed that logging in a user using django.contrib.auth.login deletes all custom and third party cookies previously set. This is breaking lots of things, such as my Google Web Optimizer tests, which can 开发者_StackOverflow中文版no longer track the user. What's the best way to prevent this when logging in a user?
Looking at the code for login() in django/contrib/auth/__init__.py
doesn't show a lot of customizability, and the culprit seems to be line request.session.flush()
. My first thought was to simply copy the request.COOKIES dictionary before the call to login(), and then copy it back to the request post-login, but I'm not sure what Django cookies to exclude.
are you sure your cookies are really on the same domain?
Two different domains
www.mysite.com
mysite.com
I've never had django screw with cookies, but I have had www vs non-www cookie issues.
精彩评论