aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--wqflask/wqflask/user_session.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/wqflask/wqflask/user_session.py b/wqflask/wqflask/user_session.py
index 20c8d84d..8d4b915a 100644
--- a/wqflask/wqflask/user_session.py
+++ b/wqflask/wqflask/user_session.py
@@ -42,7 +42,7 @@ class UserSession(object):
"""Logged in user handling"""
user_cookie_name = 'session_id_v1'
- anon_cookie_name = 'anon_user_v1'
+ anon_cookie_name = 'anon_user_v2'
def __init__(self):
user_cookie = request.cookies.get(self.user_cookie_name)
@@ -66,8 +66,9 @@ class UserSession(object):
#ZS: If user correctled logged in but their session expired
#ZS: Need to test this by setting the time-out to be really short or something
- if not self.record:
+ if not self.record or self.record == []:
if user_cookie:
+ logger.debug("NOT RECORD YES USER COOKIE")
self.logged_in = False
########### Grrr...this won't work because of the way flask handles cookies
@@ -78,6 +79,7 @@ class UserSession(object):
#return response
#return
else:
+ logger.debug("NOT RECORD NO USER COOKIE")
self.record = dict(login_time = time.time(),
user_type = "anon",
user_id = str(uuid.uuid4()))
@@ -85,6 +87,7 @@ class UserSession(object):
Redis.hmset(self.redis_key, self.record)
Redis.expire(self.redis_key, THIRTY_DAYS)
else:
+ logger.debug("YES SELF.RECORD")
if user_cookie:
self.logged_in = True
@@ -128,6 +131,8 @@ class UserSession(object):
else: #ZS: Anonymous user
return None
+ logger.debug("REDIS USER ID:", user_id)
+
return user_id
@property