Browse Source

No Ticket. Because secret_key may change, capture SuspiciousOperation in listing of active users.

Philip Zeyliger 15 years ago
parent
commit
be23fd008d
1 changed files with 7 additions and 1 deletions
  1. 7 1
      desktop/core/src/desktop/auth/views.py

+ 7 - 1
desktop/core/src/desktop/auth/views.py

@@ -19,6 +19,7 @@ import logging
 import threading
 
 import django.contrib.auth.views
+from django.core.exceptions import SuspiciousOperation
 
 from django.core import urlresolvers
 from django.contrib.auth import authenticate, login, get_backends
@@ -66,7 +67,12 @@ def get_current_users():
   a dictionary of the user's IP address and last access time"""
   current_users = { }
   for session in Session.objects.all():
-    uid = session.get_decoded().get(django.contrib.auth.SESSION_KEY)
+    try:
+      uid = session.get_decoded().get(django.contrib.auth.SESSION_KEY)
+    except SuspiciousOperation:
+      # If secret_key changed, this resolution won't work.
+      uid = None
+
     if uid is not None:
       try:
         userobj = User.objects.get(pk=uid)