Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » SESSION_EXPIRE_AT_BROWSER_CLOSE = True, session expiry date wrong when browser closed? [RSS Feed]

#1 Dec. 10, 2010 13:28:03

S.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

SESSION_EXPIRE_AT_BROWSER_CLOSE = True, session expiry date wrong when browser closed?


I have SESSION_EXPIRE_AT_BROWSER_CLOSE set to True in my settings.
When the user visits my custom login page a new session is created for
them in the database. The expiry time is set to two weeks.

If I then close the browser, the expiry hour/minute are adjusted but
it's still set to two weeks in the future. Shouldn't the expiry date
be set to the current date?

If I re-open the browser, login and then close the browser, the
session expiry time is still set to two weeks. Shouldn't the expiry
date be set to the current date? The session is expired because I have
to re-login when I visit the site again.

Thanks

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 Dec. 10, 2010 13:57:30

Tom E.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

SESSION_EXPIRE_AT_BROWSER_CLOSE = True, session expiry date wrong when browser closed?


On Fri, Dec 10, 2010 at 1:27 PM, Stodge <sto...@gmail.com> wrote:
> I have SESSION_EXPIRE_AT_BROWSER_CLOSE set to True in my settings.
> When the user visits my custom login page a new session is created for
> them in the database. The expiry time is set to two weeks.
>
> If I then close the browser, the expiry hour/minute are adjusted but
> it's still set to two weeks in the future. Shouldn't the expiry date
> be set to the current date?
>
> If I re-open the browser, login and then close the browser, the
> session expiry time is still set to two weeks. Shouldn't the expiry
> date be set to the current date? The session is expired because I have
> to re-login when I visit the site again.
>
> Thanks
>

SESSION_EXPIRE_AT_BROWSER_CLOSE denotes whether the session cookie is
set as a session cookie (browser removes the cookie when it closes) or
whether it is a permanent cookie (with lifetime equal to the expiry
date set in the model).

It does not affect anything to do with stored sessions, so the session
expiry date does not change in the DB, your browser just loses the
session id when it is closed, and so when it is re-opened it can no
longer access the (still valid, and not expired) session.

Cheers

Tom

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#3 Dec. 10, 2010 14:12:47

Matthias R.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

SESSION_EXPIRE_AT_BROWSER_CLOSE = True, session expiry date wrong when browser closed?


AFAIK there is a known bug in FireFox preventing it from working correctly. Try
(nearly) any other browser.



"Stodge" <sto...@gmail.com> schrieb:

>I have SESSION_EXPIRE_AT_BROWSER_CLOSE set to True in my settings.
>When the user visits my custom login page a new session is created for
>them in the database. The expiry time is set to two weeks.
>
>If I then close the browser, the expiry hour/minute are adjusted but
>it's still set to two weeks in the future. Shouldn't the expiry date
>be set to the current date?
>
>If I re-open the browser, login and then close the browser, the
>session expiry time is still set to two weeks. Shouldn't the expiry
>date be set to the current date? The session is expired because I have
>to re-login when I visit the site again.
>
>Thanks
>
>--
>You received this message because you are subscribed to the Google
>Groups "Django users" group.
>To post to this group, send email to django-us...@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.

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#4 Dec. 10, 2010 14:34:23

S.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

SESSION_EXPIRE_AT_BROWSER_CLOSE = True, session expiry date wrong when browser closed?


Ok thanks. I'm trying to limit the number of concurrent users using
sessions.

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

  • Root
  • » Django
  • » SESSION_EXPIRE_AT_BROWSER_CLOSE = True, session expiry date wrong when browser closed? [RSS Feed]

Board footer

Moderator control

Enjoy the 23rd of October
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support