#25770: authenticate and login can not write cookie 'sessionid'
------------------------------+----------------------------------------
     Reporter:  mrgaolei      |      Owner:  nobody
         Type:  Bug           |     Status:  new
    Component:  contrib.auth  |    Version:  1.8
     Severity:  Normal        |   Keywords:  authenticate login session
 Triage Stage:  Unreviewed    |  Has patch:  0
Easy pickings:  0             |      UI/UX:  0
------------------------------+----------------------------------------
 If I use 'django.contrib.auth.urls' login, everything are OK, cookie
 'sessionid' writes to Browser.

 But, when I login Manually, like:

 {{{
 from django.contrib.auth import authenticate, login, logout
 def some_view(request):
     user = authenticate(username="mrgaolei", password="123456")
     if user is not None:
         login(request, user)
 }}}

 No any exceptions, but user not loginged, and no cookie 'sessionid' writes
 to Browser.
 My settings.py is generated by manage.py startproject.

 I tried capture login status like:

 {{{
 from django.contrib.auth import authenticate, login, logout
 def some_view(request):
     print request.user.is_authenticated()
     user = authenticate(username="mrgaolei", password="123456")
     if user is not None:
         login(request, user)
         print request.user.is_authenticated()
 }}}

 When I refresh this url, terminal output:
 {{{
 False
 True
 }}}

 It seems the 'login' method writes the 'sessionid` cookie expire only 1
 second.
 Is this a bug? Or my fault?

--
Ticket URL: <https://code.djangoproject.com/ticket/25770>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/051.5b89c30015ff24110c602412c7970ed2%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to