瀏覽代碼

HUE-5050 [core] Logout fails for local login when multiple backends are used

krish 9 年之前
父節點
當前提交
1c01549
共有 1 個文件被更改,包括 9 次插入4 次删除
  1. 9 4
      desktop/core/src/desktop/auth/views.py

+ 9 - 4
desktop/core/src/desktop/auth/views.py

@@ -194,10 +194,15 @@ def dt_logout(request, next_page=None):
   if backends:
     for backend in backends:
       if hasattr(backend, 'logout'):
-        response = backend.logout(request, next_page)
-        if response:
-          return response
-
+        try:
+          response = backend.logout(request, next_page)
+          if response:
+            return response
+        except Exception, e:
+          LOG.warn('Potential error on logout for user: %s with exception: %s' % (username, e))
+
+  if len(filter(lambda backend: hasattr(backend, 'logout'), backends)) == len(backends):
+    LOG.warn("Failed to log out from all backends for user: %s" % (username))
   return django.contrib.auth.views.logout(request, next_page)