On Fri, Aug 21, 2009 at 12:17 AM, Kelvan<kelvan.mailingl...@gmail.com> wrote: > > I've a big problem with user authentification, my application get an > username and a hashkey to verify if the user is logged in. I wrote a > function that check this, it worked fine to log in the user with: > > user.backend = 'django.contrib.auth.backends.ModelBackend' > login( request, user ) > > Login works, clicking around works, but doing nothing a few seconds > and than click on a menu entry logs me out and redirects to the login > screen. > > debug_toolbar shows me this sql queries (all made by > request.user.is_authenticated): > > SELECT `django_session`.`session_key`, > `django_session`.`session_data`, `django_session`.`expire_date` FROM > `django_session` WHERE (`django_session`.`session_key` = > 000000008373a54580503b02238a3f45 AND `django_session`.`expire_date` > > 2009-08-20 17:59:44 ) > > SELECT `django_session`.`session_key`, > `django_session`.`session_data`, `django_session`.`expire_date` FROM > `django_session` WHERE `django_session`.`session_key` = > 00000000a2aabd791f8e593d9dbf7e21 > > > INSERT INTO `django_session` (`session_key`, `session_data`, > `expire_date`) VALUES (00000000a2aabd791f8e593d9dbf7e21, > gAJ9cQEuMDAwMDAwMDA0OGU1MTExNWYxNzY3YjcyZjc2MmFkZGI= , 2009-08-20 > 18:59:45) > > I check the database and the first session expire_date is in the > future, so the session is active, but why did Django flushes the old > session and creating a new one?
I've seen this in the past, with a couple of different causes: - Safari and Firefox both have a "private browsing" setting that can cause this behavior. - You can also have this problem if you are having DNS or other related name resolution errors (for example if your DNS entry is propagating, or you're on dynamic DNS, or you're playing reverse DNS tricks behind a proxy). - If you are running two sites with the same site secret, the two sites can tread on each other. I don't know if these are causing your problems in particular, but hopefully it gives you some ideas. Worst case, crack open the debugger and look at the sessions backend to see what code branch is causing the session to expire. Yours, Russ Magee %-) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---