diff options
| author | Gary Wilson Jr <gary.wilson@gmail.com> | 2007-12-11 06:37:07 +0000 |
|---|---|---|
| committer | Gary Wilson Jr <gary.wilson@gmail.com> | 2007-12-11 06:37:07 +0000 |
| commit | a4478ee9c6acf0e50fa37265e2af20b9da856ba1 (patch) | |
| tree | 7e35450eda903525668d2bc75ea5f628b542dbdc | |
| parent | a944613b3a71bd5a4749a75119775271b4b009cc (diff) | |
Fixed #6174 -- Made `AnonymousUser.is_active` False instead of True since `AnonymousUser`s can't login. Thanks, `SmileyChris`.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6912 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/contrib/auth/models.py | 2 | ||||
| -rw-r--r-- | django/contrib/auth/tests.py | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/django/contrib/auth/models.py b/django/contrib/auth/models.py index 33f92dc854..4b1590264b 100644 --- a/django/contrib/auth/models.py +++ b/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() diff --git a/django/contrib/auth/tests.py b/django/contrib/auth/tests.py index 329049c546..d369ac524c 100644 --- a/django/contrib/auth/tests.py +++ b/django/contrib/auth/tests.py @@ -16,9 +16,21 @@ False >>> 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() |
