Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #335 -- Admin login form now checks that cookies are enabled.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@529 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit b1d9682a380484950b92f7fa37acd2b6f212578f 1 parent 8acb6c8
Adrian Holovaty authored August 17, 2005

Showing 1 changed file with 6 additions and 0 deletions. Show diff stats Hide diff stats

  1. 6  django/middleware/admin.py
6  django/middleware/admin.py
@@ -48,6 +48,11 @@ def process_view(self, request, view_func, param_dict):
48 48
                 message = ""
49 49
             return self.display_login_form(request, message)
50 50
 
  51
+        # Check that the user accepts cookies.
  52
+        if not request.session.test_cookie_worked():
  53
+            message = "Looks like your browser isn't configured to accept cookies. Please enable cookies, reload this page, and try again."
  54
+            return self.display_login_form(request, message)
  55
+
51 56
         # Check the password
52 57
         username = request.POST.get('username', '')
53 58
         try:
@@ -81,6 +86,7 @@ def process_view(self, request, view_func, param_dict):
81 86
                 return self.display_login_form(request, ERROR_MESSAGE)
82 87
 
83 88
     def display_login_form(self, request, error_message=''):
  89
+        request.session.set_test_cookie()
84 90
         if request.POST and request.POST.has_key('post_data'):
85 91
             # User has failed login BUT has previously saved 'post_data'
86 92
             post_data = request.POST['post_data']

0 notes on commit b1d9682

Please sign in to comment.
Something went wrong with that request. Please try again.