Ticket #1234: last_login_clear_pass.diff
File last_login_clear_pass.diff, 1.7 KB (added by , 19 years ago) |
---|
-
contrib/admin/views/decorators.py
4 4 from django.utils import httpwrappers 5 5 import base64, md5 6 6 import cPickle as pickle 7 import datetime 7 8 8 9 ERROR_MESSAGE = "Please enter a correct username and password. Note that both fields are case-sensitive." 9 10 LOGIN_FORM_KEY = 'this_is_the_login_form' … … 46 47 def _checklogin(request, *args, **kwargs): 47 48 if not request.user.is_anonymous() and request.user.is_staff: 48 49 # The user is valid. Continue to the admin page. 50 if request.POST.has_key('post_data'): 51 # we must have re-authenticated through a different window or tab 52 request.POST = _decode_post_data(request.POST['post_data']) 49 53 return view_func(request, *args, **kwargs) 50 54 51 55 assert hasattr(request, 'session'), "The Django admin requires session middleware to be installed. Edit your MIDDLEWARE_CLASSES setting to insert 'django.middleware.sessions.SessionMiddleware'." … … 83 87 else: 84 88 if user.check_password(request.POST.get('password', '')): 85 89 request.session[users.SESSION_KEY] = user.id 90 # keep track of last login 91 user.last_login = datetime.datetime.now() 92 user.save() 86 93 if request.POST.has_key('post_data'): 87 94 post_data = _decode_post_data(request.POST['post_data']) 88 95 if post_data and not post_data.has_key(LOGIN_FORM_KEY):