Browse Source

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

krish 9 năm trước cách đây
mục cha
commit
1c01549d3e
1 tập tin đã thay đổi với 9 bổ sung4 xóa
  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)