You need to upgrade to latest nodebb for the latest recent cards plugin. If you want to stay on 1.14.3 downgrade recent cards to 1.0.13
Set user field fails in plugin
-
Hello,
I created a plugin from a template that authenticates against an LDAP server, the code works fine but i also wanted to set some user fields if the user needs to be created. I looked up the code and it seems that i should be using : user.setUserField(uid, 'fullname', user.givenName + " " + user.sn); but this causes the whole plugin to error. User is declared earlier in my code and works fine since the user is created if i remove the user.setUserField.
My code is below:
ldap.authenticate(username, password, function (err, user) { if (err) { next(new Error('[[error:invalid-username-or-password]]')); } else { User.getUidByEmail(user.mail, function (err, uid) { if (err) { return callback(err); } if (!uid) { User.create({ username: user.sAMAccountName.toLowerCase(), email: user.mail }, function (err, uid) { if (err) { return callback(err); } user.setUserField(uid, 'fullname', user.givenName + " " + user.sn); next(null, { uid: uid }, '[[success:authentication-successful]]'); }); } else { next(null, { uid: uid }, '[[success:authentication-successful]]'); } }); } ldap.close(function (err) { if (err) { console.log("LDAP closing error: %s", err); } else { console.log("Success in closing"); } }); });
Am i doing something wrong?
Thanks