summaryrefslogtreecommitdiff
path: root/yaksh/middleware/one_session_per_user.py
diff options
context:
space:
mode:
Diffstat (limited to 'yaksh/middleware/one_session_per_user.py')
-rw-r--r--yaksh/middleware/one_session_per_user.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/yaksh/middleware/one_session_per_user.py b/yaksh/middleware/one_session_per_user.py
index d9e97bb..f382652 100644
--- a/yaksh/middleware/one_session_per_user.py
+++ b/yaksh/middleware/one_session_per_user.py
@@ -1,22 +1,21 @@
from django.contrib.auth.models import User
from django.contrib.sessions.models import Session
-from yaksh.models import Visitor
+from yaksh.models import ConcurrentUser
class OneSessionPerUserMiddleware(object):
def process_request(self, request):
if isinstance(request.user, User):
current_key = request.session.session_key
- if hasattr(request.user, 'visitor'):
- active_key = request.user.visitor.session_key
- print active_key, current_key
+ if hasattr(request.user, 'concurrentuser'):
+ active_key = request.user.concurrentuser.session_key
if active_key != current_key:
Session.objects.filter(session_key=active_key).delete()
- request.user.visitor.session_key = current_key
- request.user.visitor.save()
+ request.user.concurrentuser.session_key = current_key
+ request.user.concurrentuser.save()
else:
- Visitor.objects.create(
- visitor_user=request.user,
+ ConcurrentUser.objects.create(
+ concurrent_user=request.user,
session_key=current_key,
) \ No newline at end of file