nodebb-plugin-sso-facebook 4.1.0 → 4.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/library.js +10 -20
  2. package/package.json +2 -2
package/library.js CHANGED
@@ -206,9 +206,10 @@
206
206
  async.waterfall([
207
207
  // Reset email confirm throttle
208
208
  async.apply(db.delete, 'uid:' + userData.uid + ':confirm:email:sent'),
209
- async.apply(user.getUserField, userData.uid, 'email'),
209
+ function (next) {
210
+ user.getUserField(userData.uid, 'email', next);
211
+ },
210
212
  function (email, next) {
211
- // Remove the old email from sorted set reference
212
213
  db.sortedSetRemove('email:uid', email, next);
213
214
  },
214
215
  async.apply(user.setUserField, userData.uid, 'email', data.email),
@@ -309,24 +310,13 @@
309
310
  callback(null, custom_header);
310
311
  };
311
312
 
312
- Facebook.deleteUserData = function (data, callback) {
313
- var uid = data.uid;
314
-
315
- async.waterfall([
316
- async.apply(user.getUserField, uid, 'fbid'),
317
- function (oAuthIdToDelete, next) {
318
- db.deleteObjectField('fbid:uid', oAuthIdToDelete, next);
319
- },
320
- function (next) {
321
- db.deleteObjectField('user:' + uid, 'fbid', next);
322
- },
323
- ], function (err) {
324
- if (err) {
325
- winston.error('[sso-facebook] Could not remove OAuthId data for uid ' + uid + '. Error: ' + err);
326
- return callback(err);
327
- }
328
- callback(null, uid);
329
- });
313
+ Facebook.deleteUserData = async function (data) {
314
+ const { uid } = data;
315
+ const fbid = await user.getUserField(uid, 'fbid');
316
+ if (fbid) {
317
+ await db.deleteObjectField('fbid:uid', oAuthIdToDelete);
318
+ await db.deleteObjectField('user:' + uid, 'fbid');
319
+ }
330
320
  };
331
321
 
332
322
  module.exports = Facebook;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-sso-facebook",
3
- "version": "4.1.0",
3
+ "version": "4.1.1",
4
4
  "description": "NodeBB Facebook SSO",
5
5
  "main": "library.js",
6
6
  "repository": {
@@ -29,6 +29,6 @@
29
29
  "passport-facebook": "~1.0.2"
30
30
  },
31
31
  "nbbpm": {
32
- "compatibility": "^3.2.0"
32
+ "compatibility": "^4.0.0"
33
33
  }
34
34
  }