Просмотр исходного кода

Fixed issue #1114 - Configuration of LDAP with disabled anonymous bind fails.

Thorsten Eckel 7 лет назад
Родитель
Сommit
017022eae9

+ 7 - 6
app/assets/javascripts/app/controllers/_integration/ldap.coffee

@@ -287,12 +287,13 @@ class ConnectionWizard extends App.WizardModal
 
         option = ''
         options = {}
-        for dn in data.attributes.namingcontexts
-          options[dn] = dn
-          if option is ''
-            option = dn
-          if option.length > dn.length
-            option = dn
+        if !_.isEmpty data.attributes
+          for dn in data.attributes.namingcontexts
+            options[dn] = dn
+            if option is ''
+              option = dn
+            if option.length > dn.length
+              option = dn
 
         @wizardConfig.options = options
         @wizardConfig.option = option

+ 14 - 5
app/controllers/integration/ldap_controller.rb

@@ -14,12 +14,21 @@ class Integration::LdapController < ApplicationController
       attributes: ldap.preferences,
     }
   rescue => e
-    logger.error e
+    # workaround for issue #1114
+    if e.message.end_with?(', 48, Inappropriate Authentication')
+      result = {
+        result:     'ok',
+        attributes: {},
+      }
+    else
+      logger.error e
+      result = {
+        result:  'failed',
+        message: e.message,
+      }
+    end
 
-    render json: {
-      result:  'failed',
-      message: e.message,
-    }
+    render json: result
   end
 
   def bind