Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #4015 -- Changed login() and logout() messages to update reques…

…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...
commit 44dd91ec6d39525e52b78f7fff6de8531b980f5f 1 parent 762e677
@malcolmt malcolmt authored
Showing with 5 additions and 0 deletions.
  1. +5 −0 django/contrib/auth/__init__.py
View
5 django/contrib/auth/__init__.py
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.