Skip to content

Commit

Permalink
Fixed #4015 -- Changed login() and logout() messages to update reques…
Browse files Browse the repository at this point in the history
…t.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
  • Loading branch information
malcolmt committed Jun 15, 2007
1 parent 762e677 commit 44dd91e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions django/contrib/auth/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand All @@ -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
Expand Down

0 comments on commit 44dd91e

Please sign in to comment.