mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #4526 -- Modified the test Client login method to fail when a user is inactive. Thanks, marcin@elksoft.pl.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5677 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -225,10 +225,11 @@ class Client:
|
||||
"""Set the Client to appear as if it has sucessfully logged into a site.
|
||||
|
||||
Returns True if login is possible; False if the provided credentials
|
||||
are incorrect, or if the Sessions framework is not available.
|
||||
are incorrect, or the user is inactive, or if the Sessions framework is
|
||||
not available.
|
||||
"""
|
||||
user = authenticate(**credentials)
|
||||
if user and 'django.contrib.sessions' in settings.INSTALLED_APPS:
|
||||
if user and user.is_active and 'django.contrib.sessions' in settings.INSTALLED_APPS:
|
||||
obj = Session.objects.get_new_session_object()
|
||||
|
||||
# Create a fake request to store login details
|
||||
|
||||
Reference in New Issue
Block a user