mirror of
https://github.com/zulip/zulip.git
synced 2026-06-24 21:08:25 +08:00
Improve LDAP_APPEND_DOMAIN default.
The documentation suggests the default is None; this change makes that true. Also make the actual code robust to this being set to "" instead.
This commit is contained in:
parent
71a06d58de
commit
5d22f5ee0a
@ -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
|
||||
|
||||
|
||||
@ -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 = {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user