Fixed #3379 -- Changed login() so that we update last_login when a user

logs in. Thanks, arvin.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5074 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2007-04-25 09:44:06 +00:00
parent 2a7d9ef23f
commit 74bab89178
2 changed files with 3 additions and 2 deletions

View File

@ -90,8 +90,6 @@ def staff_member_required(view_func):
if user.is_active and user.is_staff:
login(request, user)
# TODO: set last_login with an event.
user.last_login = datetime.datetime.now()
user.save()
if request.POST.has_key('post_data'):
post_data = _decode_post_data(request.POST['post_data'])
if post_data and not post_data.has_key(LOGIN_FORM_KEY):

View File

@ -1,3 +1,4 @@
import datetime
from django.core.exceptions import ImproperlyConfigured
SESSION_KEY = '_auth_user_id'
@ -48,6 +49,8 @@ def login(request, user):
if user is None:
user = request.user
# TODO: It would be nice to support different login methods, like signed cookies.
user.last_login = datetime.datetime.now()
user.save()
request.session[SESSION_KEY] = user.id
request.session[BACKEND_SESSION_KEY] = user.backend