Browse Source

Dropped magic from cookie handling.

Ralfp 12 years ago
parent
commit
9128232072
2 changed files with 8 additions and 7 deletions
  1. 2 2
      deployment/settings.py
  2. 6 5
      misago/cookie_jar/cookie_jar.py

+ 2 - 2
deployment/settings.py

@@ -36,8 +36,8 @@ DATABASES = {
 CACHES = {}
 
 # Cookies configuration
-COOKIES_DOMAIN = '' # Set empty for automatic detection.
-COOKIES_PATH = '' # Set empty for automatic detection.
+COOKIES_DOMAIN = '' # For example cookie domain for "www.mysite.com" or "forum.mysite.com" is ".mysite.com"
+COOKIES_PATH = ''
 COOKIES_PREFIX = '' # Allows you to avoid cookies collisions with other applications.
 COOKIES_SECURE = False # Set this to true if AND ONLY IF you are using SSL on your forum.
 

+ 6 - 5
misago/cookie_jar/cookie_jar.py

@@ -1,3 +1,4 @@
+from datetime import datetime, timedelta
 from django.conf import settings
 
 class CookieJar(object):
@@ -26,13 +27,13 @@ class CookieJar(object):
                                 settings.COOKIES_PREFIX + cookie['name'],
                                 cookie['value'],
                                 max_age=cookie['max_age'],
-                                path=settings.COOKIES_PATH or '/',
-                                domain=settings.COOKIES_DOMAIN or None,
-                                secure=settings.COOKIES_SECURE or False
+                                path=settings.COOKIES_PATH,
+                                domain=settings.COOKIES_DOMAIN,
+                                secure=settings.COOKIES_SECURE
                                 )
         for cookie in self._delete_cookies:
             response.delete_cookie(
                                    settings.COOKIES_PREFIX + cookie,
-                                   path=settings.COOKIES_PATH or '/',
-                                   domain=settings.COOKIES_DOMAIN or None
+                                   path=settings.COOKIES_PATH,
+                                   domain=settings.COOKIES_DOMAIN,
                                    )