From 3c2a4703bceb19a10c0fc2c0d719a86bfe255ab0 Mon Sep 17 00:00:00 2001 From: ibuler Date: Thu, 21 Feb 2019 16:37:36 +0800 Subject: [PATCH] =?UTF-8?q?[Update]=20ldap=E5=85=81=E8=AE=B8=E7=A9=BA?= =?UTF-8?q?=E5=AF=86=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/authentication/ldap/backends.py | 9 ++------- apps/common/forms.py | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/apps/authentication/ldap/backends.py b/apps/authentication/ldap/backends.py index 9b9ed24c3..7fcccc046 100644 --- a/apps/authentication/ldap/backends.py +++ b/apps/authentication/ldap/backends.py @@ -16,13 +16,8 @@ class LDAPAuthorizationBackend(LDAPBackend): """ def authenticate(self, request=None, username=None, password=None, **kwargs): - if password or self.settings.PERMIT_EMPTY_PASSWORD: - ldap_user = LDAPUser(self, username=username.strip(), request=request) - user = self.authenticate_ldap_user(ldap_user, password) - else: - logger.debug('Rejecting empty password for {}'.format(username)) - user = None - + ldap_user = LDAPUser(self, username=username.strip(), request=request) + user = self.authenticate_ldap_user(ldap_user, password) return user def get_user(self, user_id): diff --git a/apps/common/forms.py b/apps/common/forms.py index 36ab924b7..1f7e4c1fd 100644 --- a/apps/common/forms.py +++ b/apps/common/forms.py @@ -96,7 +96,7 @@ class LDAPSettingForm(BaseForm): label=_("LDAP server"), ) AUTH_LDAP_BIND_DN = forms.CharField( - label=_("Bind DN"), + required=False, label=_("Bind DN"), ) AUTH_LDAP_BIND_PASSWORD = FormEncryptCharField( label=_("Password"),