diff --git a/src/externalldap.js b/src/externalldap.js index dbf36a40c..9f374209b 100644 --- a/src/externalldap.js +++ b/src/externalldap.js @@ -291,10 +291,7 @@ async function verifyPassword(user, password) { const client = await getClient(externalLdapConfig, { bind: false }); - // create a separate function on the instance so we can call the promisified version with the correct this pointer - client.bindPromisified = util.promisify(client.bind); - - const [error] = await safe(client.bindPromisified(ldapUsers[0].dn, password)); + const [error] = await safe(util.promisify(client.bind.bind(client))(ldapUsers[0].dn, password)); client.unbind(); if (error instanceof ldap.InvalidCredentialsError) throw new BoxError(BoxError.INVALID_CREDENTIALS); if (error) throw new BoxError(BoxError.EXTERNAL_ERROR, error);