mirror of https://github.com/django/django.git
Fixed #4015 -- Changed login() and logout() messages to update request.user if
it is relevant. Thanks James Bennett, Vinay Sajip and Gary Wilson. git-svn-id: http://code.djangoproject.com/svn/django/trunk@5472 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
762e677d26
commit
44dd91ec6d
|
@ -53,6 +53,8 @@ def login(request, user):
|
|||
user.save()
|
||||
request.session[SESSION_KEY] = user.id
|
||||
request.session[BACKEND_SESSION_KEY] = user.backend
|
||||
if hasattr(request, 'user'):
|
||||
request.user = user
|
||||
|
||||
def logout(request):
|
||||
"""
|
||||
|
@ -66,6 +68,9 @@ def logout(request):
|
|||
del request.session[BACKEND_SESSION_KEY]
|
||||
except KeyError:
|
||||
pass
|
||||
if hasattr(request, 'user'):
|
||||
from django.contrib.auth.models import AnonymousUser
|
||||
request.user = AnonymousUser()
|
||||
|
||||
def get_user(request):
|
||||
from django.contrib.auth.models import AnonymousUser
|
||||
|
|
Loading…
Reference in New Issue