diff --git a/frappe/integrations/doctype/ldap_settings/ldap_settings.py b/frappe/integrations/doctype/ldap_settings/ldap_settings.py index f243e689e3..dc089d7b3b 100644 --- a/frappe/integrations/doctype/ldap_settings/ldap_settings.py +++ b/frappe/integrations/doctype/ldap_settings/ldap_settings.py @@ -224,7 +224,7 @@ class LDAPSettings(Document): groups = self.fetch_ldap_groups(user, conn) # only try and connect as the user, once we have their fqdn entry. - if conn.rebind(user=user.entry_dn, password=password): + if user.entry_dn and password and conn.rebind(user=user.entry_dn, password=password): return self.create_or_update_user(self.convert_ldap_entry_to_dict(user), groups=groups) raise ldap3.core.exceptions.LDAPInvalidCredentialsResult # even though nothing foundor failed authentication raise invalid credentials