mirror of https://github.com/jumpserver/jumpserver
[Update] ldap允许空密码
parent
4904aac2df
commit
3c2a4703bc
|
@ -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):
|
||||
|
|
|
@ -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"),
|
||||
|
|
Loading…
Reference in New Issue