Forcing UID value
-
i've made a fork of nodebb-plugin-login-mysite ( https://github.com/SimosNap/nodebb-plugin-login-anope ) to login to the forum using IRC anope account. On IRC users can change both username and email so UID is the only things i can refer for account updates
-
@julian Pheraps i miss something , i don't see an user hash field in user table :
[ { uid: 4,
username: 'antani',
userslug: 'antani',
picture: '',
status: 'online',
postcount: 0,
reputation: 0,
'email:confirmed': 0,
lastonline: 1542925209728,
flags: null,
banned: 0,
'banned:expire': 0,
joindate: 1542925209728,
uploadedpicture: undefined,
'icon:text': 'A',
'icon:bgColor': '#2196f3',
joindateISO: '2018-11-22T22:20:09.728Z',
lastonlineISO: '2018-11-22T22:20:09.728Z',
banned_until: 0,
banned_until_readable: 'Not Banned',
administrator: false } ] -
@Simos what you just posted is what Julian referred to by "user hash". He was saying "hash table" otherwise called an object or a dictionary.
-
@PitaJ i've try to add the remoteid on user.create :
console.log(_uid); if (!_uid) { user.create({ remoteid: userObj.uid, username: userObj.display, email: userObj.email }, callback); } else { callback(null, _uid) }
I suppose it don't add the remoteid value because remoteid field doesn't exist right ?
-
You will need a plugin to save the
remoteid
into the user hash, so in your plugin listen for'filter:user.create'
here is how it should look.myPlugin.filterUserCreate = function (hookData, callback) { hookData.user.remoteid = hookData.data.remoteid; callback(null, hookData); };
-
@julian it look getUserField() need nodebb uid i've to get userdata having the remoteid (the customfield i've added)
plugin.filterUserCreate = function (data, callback) {
data.user.auid = data.data.auid;
callback(null, data);
};plugin.whitelistFields = function(data, callback) {
data.whitelist.push('auid');
callback(null, data);
}; -
Yeah you'll have to save a map of auids to uids in the database.