mirror of https://github.com/django/django.git
Disabled access to the admin site for inactive accounts, and clarified documentation regarding User.is_active. Thanks to Enrico <rico.bl@gmail.com> for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3884 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
fa8a1d252a
commit
14fb13da7e
|
@ -87,7 +87,7 @@ def staff_member_required(view_func):
|
||||||
|
|
||||||
# The user data is correct; log in the user in and continue.
|
# The user data is correct; log in the user in and continue.
|
||||||
else:
|
else:
|
||||||
if user.is_staff:
|
if user.is_active and user.is_staff:
|
||||||
login(request, user)
|
login(request, user)
|
||||||
# TODO: set last_login with an event.
|
# TODO: set last_login with an event.
|
||||||
user.last_login = datetime.datetime.now()
|
user.last_login = datetime.datetime.now()
|
||||||
|
|
|
@ -66,8 +66,8 @@ Fields
|
||||||
long and can contain any character. See the "Passwords" section below.
|
long and can contain any character. See the "Passwords" section below.
|
||||||
* ``is_staff`` -- Boolean. Designates whether this user can access the
|
* ``is_staff`` -- Boolean. Designates whether this user can access the
|
||||||
admin site.
|
admin site.
|
||||||
* ``is_active`` -- Boolean. Designates whether this user can log into the
|
* ``is_active`` -- Boolean. Designates whether this account can be used
|
||||||
Django admin. Set this to ``False`` instead of deleting accounts.
|
to log in. Set this flag to ``False`` instead of deleting accounts.
|
||||||
* ``is_superuser`` -- Boolean. Designates that this user has all permissions
|
* ``is_superuser`` -- Boolean. Designates that this user has all permissions
|
||||||
without explicitly assigning them.
|
without explicitly assigning them.
|
||||||
* ``last_login`` -- A datetime of the user's last login. Is set to the
|
* ``last_login`` -- A datetime of the user's last login. Is set to the
|
||||||
|
|
Loading…
Reference in New Issue