Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #6174 -- Made `AnonymousUser.is_active` False instead of True s…

…ince `AnonymousUser`s can't login. Thanks, `SmileyChris`.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@6912 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit a4478ee9c6acf0e50fa37265e2af20b9da856ba1 1 parent a944613
@gdub gdub authored
Showing with 13 additions and 1 deletion.
  1. +1 −1  django/contrib/auth/models.py
  2. +12 −0 django/contrib/auth/tests.py
View
2  django/contrib/auth/models.py
@@ -322,7 +322,7 @@ class AnonymousUser(object):
id = None
username = ''
is_staff = False
- is_active = True
+ is_active = False
is_superuser = False
_groups = EmptyManager()
_user_permissions = EmptyManager()
View
12 django/contrib/auth/tests.py
@@ -16,9 +16,21 @@
>>> u2 = User.objects.create_user('testuser2', 'test2@example.com')
>>> u2.has_usable_password()
False
+
+>>> u.is_authenticated()
+True
+>>> u.is_staff
+False
+>>> u.is_active
+True
+
>>> a = AnonymousUser()
+>>> a.is_authenticated()
+False
>>> a.is_staff
False
+>>> a.is_active
+False
>>> a.groups.all()
[]
>>> a.user_permissions.all()
Please sign in to comment.
Something went wrong with that request. Please try again.