summaryrefslogtreecommitdiffstats
path: root/app/models/auth_source_ldap.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/auth_source_ldap.rb')
-rw-r--r--app/models/auth_source_ldap.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/models/auth_source_ldap.rb b/app/models/auth_source_ldap.rb
index b18b657b0..6dda73d9f 100644
--- a/app/models/auth_source_ldap.rb
+++ b/app/models/auth_source_ldap.rb
@@ -56,11 +56,16 @@ class AuthSourceLdap < AuthSource
raise AuthSourceException.new(e.message)
end
- # test the connection to the LDAP
+ # Test the connection to the LDAP
def test_connection
with_timeout do
ldap_con = initialize_ldap_con(self.account, self.account_password)
ldap_con.open { }
+
+ if self.account.present? && self.account_password.present?
+ ldap_auth = authenticate_dn(self.account, self.account_password)
+ raise AuthSourceException.new(l(:error_ldap_bind_credentials)) if !ldap_auth
+ end
end
rescue *NETWORK_EXCEPTIONS => e
raise AuthSourceException.new(e.message)