nodebb-plugin-sso-facebook 4.1.0 → 4.1.2
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.
- package/library.js +14 -29
- package/package.json +2 -2
package/library.js
CHANGED
|
@@ -40,17 +40,12 @@
|
|
|
40
40
|
service: "Facebook",
|
|
41
41
|
});
|
|
42
42
|
});
|
|
43
|
-
params.router.post('/deauth/facebook', [params.middleware.requireUser, params.middleware.applyCSRF], function (req, res, next) {
|
|
44
|
-
Facebook.deleteUserData({
|
|
43
|
+
params.router.post('/deauth/facebook', [params.middleware.requireUser, params.middleware.applyCSRF], hostHelpers.tryRoute(async function (req, res, next) {
|
|
44
|
+
await Facebook.deleteUserData({
|
|
45
45
|
uid: req.user.uid,
|
|
46
|
-
}, function (err) {
|
|
47
|
-
if (err) {
|
|
48
|
-
return next(err);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
res.redirect(nconf.get('relative_path') + '/me/edit');
|
|
52
46
|
});
|
|
53
|
-
|
|
47
|
+
res.redirect(nconf.get('relative_path') + '/me/edit');
|
|
48
|
+
}));
|
|
54
49
|
|
|
55
50
|
callback();
|
|
56
51
|
};
|
|
@@ -206,9 +201,10 @@
|
|
|
206
201
|
async.waterfall([
|
|
207
202
|
// Reset email confirm throttle
|
|
208
203
|
async.apply(db.delete, 'uid:' + userData.uid + ':confirm:email:sent'),
|
|
209
|
-
|
|
204
|
+
function (next) {
|
|
205
|
+
user.getUserField(userData.uid, 'email', next);
|
|
206
|
+
},
|
|
210
207
|
function (email, next) {
|
|
211
|
-
// Remove the old email from sorted set reference
|
|
212
208
|
db.sortedSetRemove('email:uid', email, next);
|
|
213
209
|
},
|
|
214
210
|
async.apply(user.setUserField, userData.uid, 'email', data.email),
|
|
@@ -309,24 +305,13 @@
|
|
|
309
305
|
callback(null, custom_header);
|
|
310
306
|
};
|
|
311
307
|
|
|
312
|
-
Facebook.deleteUserData = function (data
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
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
|
-
});
|
|
308
|
+
Facebook.deleteUserData = async function (data) {
|
|
309
|
+
const { uid } = data;
|
|
310
|
+
const fbid = await user.getUserField(uid, 'fbid');
|
|
311
|
+
if (fbid) {
|
|
312
|
+
await db.deleteObjectField('fbid:uid', oAuthIdToDelete);
|
|
313
|
+
await db.deleteObjectField('user:' + uid, 'fbid');
|
|
314
|
+
}
|
|
330
315
|
};
|
|
331
316
|
|
|
332
317
|
module.exports = Facebook;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nodebb-plugin-sso-facebook",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.2",
|
|
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": "^
|
|
32
|
+
"compatibility": "^4.0.0"
|
|
33
33
|
}
|
|
34
34
|
}
|