Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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
  • Loading branch information...
commit 74bab891783a6f85d7b8f8c5908bde046622654e 1 parent 2a7d9ef
@malcolmt malcolmt authored
View
2  django/contrib/admin/views/decorators.py
@@ -90,8 +90,6 @@ def _checklogin(request, *args, **kwargs):
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
3  django/contrib/auth/__init__.py
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.