mirror of
https://github.com/django/django.git
synced 2024-12-26 11:06:07 +00:00
Fixed #15043 -- Updated the login function to send the user_logged_in signal after the user's session got recycled instead of before. Thanks, Rob Hudson.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15168 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
730769d1af
commit
937548bba4
@ -70,8 +70,6 @@ def login(request, user):
|
|||||||
if user is None:
|
if user is None:
|
||||||
user = request.user
|
user = request.user
|
||||||
# TODO: It would be nice to support different login methods, like signed cookies.
|
# TODO: It would be nice to support different login methods, like signed cookies.
|
||||||
user_logged_in.send(sender=user.__class__, request=request, user=user)
|
|
||||||
|
|
||||||
if SESSION_KEY in request.session:
|
if SESSION_KEY in request.session:
|
||||||
if request.session[SESSION_KEY] != user.id:
|
if request.session[SESSION_KEY] != user.id:
|
||||||
# To avoid reusing another user's session, create a new, empty
|
# To avoid reusing another user's session, create a new, empty
|
||||||
@ -84,6 +82,7 @@ def login(request, user):
|
|||||||
request.session[BACKEND_SESSION_KEY] = user.backend
|
request.session[BACKEND_SESSION_KEY] = user.backend
|
||||||
if hasattr(request, 'user'):
|
if hasattr(request, 'user'):
|
||||||
request.user = user
|
request.user = user
|
||||||
|
user_logged_in.send(sender=user.__class__, request=request, user=user)
|
||||||
|
|
||||||
def logout(request):
|
def logout(request):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user