ldapjs / node-ldapjs

LDAP Client and Server API for node.js
http://ldapjs.org
MIT License
1.61k stars 440 forks source link

replace operation --> modification must be an Attribute #948

Closed luisfran10 closed 10 months ago

luisfran10 commented 10 months ago

I'm trying to change a user password, but the changing object throw this message:

"Error: modification must be an Attribute"

//entry example #1 const entry = { type: 'userPassword', values: Buffer.from("${newPassword}", 'utf8'),};

//entry example #2 const entry = { userPassword: Buffer.from("${newPassword}", 'utf16le')};

    const change = new Change({
      operation: 'replace',
      modification: entry,
    });

    client.modify(
      `${[this.seachAttribute]}=${user}`,
      change,
      (error: any) => {
        if (error) {
          Logger.log('modify error:', error.message);
          reject(error);
        }

        resolve(this);
      },
    );
jsumners commented 10 months ago

Duplicate #859. Solution is noted in https://github.com/ldapjs/node-ldapjs/releases/tag/v3.0.0