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:
Malcolm Tredinnick 2007-06-15 01:53:40 +00:00
parent 762e677d26
commit 44dd91ec6d
1 changed files with 5 additions and 0 deletions

View File

@ -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