

def direct_bind(self, username, password):
    '\n        Bind to username/password directly\n        '
    log.debug('Performing direct bind')
    ctx = {
        'username': username,
        'password': password,
    }
    scope = self.config.get('SCOPE', ldap.SCOPE_SUBTREE)
    user = (self.config['BIND_DN'] % ctx)
    try:
        log.debug(('Binding with the BIND_DN %s' % user))
        self.conn.simple_bind_s(user, password)
    except ldap.INVALID_CREDENTIALS:
        return None
    results = self.conn.search_s(user, scope, attrlist=self.attrlist)
    self.conn.unbind_s()
    return user.format_results(results)

dataset/ETHPy150Open ContinuumIO/flask-ldap-login/flask_ldap_login/__init__.py LDAPLoginManager.direct_bind/VarMisuse@133/195 `self`->`user`