diff --git a/zproject/backends.py b/zproject/backends.py index b1368774c1..e154803205 100644 --- a/zproject/backends.py +++ b/zproject/backends.py @@ -145,13 +145,13 @@ class ZulipLDAPAuthBackendBase(ZulipAuthMixin, LDAPBackend): return set() def django_to_ldap_username(self, username): - if settings.LDAP_APPEND_DOMAIN is not None: + if settings.LDAP_APPEND_DOMAIN: if not username.endswith("@" + settings.LDAP_APPEND_DOMAIN): raise ZulipLDAPException("Username does not match LDAP domain.") return email_to_username(username) return username def ldap_to_django_username(self, username): - if settings.LDAP_APPEND_DOMAIN is not None: + if settings.LDAP_APPEND_DOMAIN: return "@".join((username, settings.LDAP_APPEND_DOMAIN)) return username diff --git a/zproject/local_settings_template.py b/zproject/local_settings_template.py index 5d6850b866..c4f0d02087 100644 --- a/zproject/local_settings_template.py +++ b/zproject/local_settings_template.py @@ -250,7 +250,7 @@ AUTH_LDAP_USER_SEARCH = LDAPSearch("ou=users,dc=example,dc=com", # If the value of a user's "uid" (or similar) property is not their email # address, specify the domain to append here. -LDAP_APPEND_DOMAIN = ADMIN_DOMAIN +LDAP_APPEND_DOMAIN = None # This map defines how to populate attributes of a Zulip user from LDAP. AUTH_LDAP_USER_ATTR_MAP = {