Code

Ticket #7364: 7364-admin_login_cache-8345.diff

File 7364-admin_login_cache-8345.diff, 1.7 KB (added by jcassee, 6 years ago)
Line 
1Index: django/contrib/admin/views/decorators.py
2===================================================================
3--- django/contrib/admin/views/decorators.py    (revision 8345)
4+++ django/contrib/admin/views/decorators.py    (working copy)
5@@ -12,6 +12,7 @@
6 from django.shortcuts import render_to_response
7 from django.utils.translation import ugettext_lazy, ugettext as _
8 from django.utils.hashcompat import md5_constructor
9+from django.views.decorators.cache import never_cache
10 
11 ERROR_MESSAGE = ugettext_lazy("Please enter a correct username and password. Note that both fields are case-sensitive.")
12 LOGIN_FORM_KEY = 'this_is_the_login_form'
13@@ -32,6 +33,7 @@
14         'post_data': post_data,
15         'error_message': error_message
16     }, context_instance=template.RequestContext(request))
17+_display_login_form = never_cache(_display_login_form)
18 
19 def _encode_post_data(post_data):
20     pickled = pickle.dumps(post_data)
21Index: django/contrib/auth/views.py
22===================================================================
23--- django/contrib/auth/views.py        (revision 8345)
24+++ django/contrib/auth/views.py        (working copy)
25@@ -13,6 +13,7 @@
26 from django.utils.http import urlquote, base36_to_int
27 from django.utils.html import escape
28 from django.utils.translation import ugettext as _
29+from django.views.decorators.cache import never_cache
30 from django.contrib.auth.models import User
31 import re
32 
33@@ -43,6 +44,7 @@
34         redirect_field_name: redirect_to,
35         'site_name': current_site.name,
36     }, context_instance=RequestContext(request))
37+login = never_cache(login)
38 
39 def logout(request, next_page=None, template_name='registration/logged_out.html'):
40     "Logs out the user and displays 'You are logged out' message."