From 5f6f6a77e5d0d544b6d2bf6aa4c943dbb630127d Mon Sep 17 00:00:00 2001 From: Jon Lockwood Date: Sun, 25 Jul 2021 17:21:28 +0930 Subject: [PATCH] fix(ldap): ldap3 exception A blank password causes exception 'ldap3.core.exceptions.LDAPPasswordIsMandatoryError'. Validate the user input. Issue #13738 --- frappe/integrations/doctype/ldap_settings/ldap_settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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