This commit is contained in:
Julian Lam 2017-01-09 13:48:37 -05:00
parent 427dbe9890
commit 7b45882aec
2 changed files with 6 additions and 5 deletions

View File

@ -229,18 +229,19 @@
});
};
OAuth.deleteUserData = function(uid, callback) {
OAuth.deleteUserData = function(data, callback) {
async.waterfall([
async.apply(User.getUserField, uid, constants.name + 'Id'),
async.apply(User.getUserField, data.uid, constants.name + 'Id'),
function(oAuthIdToDelete, next) {
db.deleteObjectField(constants.name + 'Id:uid', oAuthIdToDelete, next);
}
], function(err) {
if (err) {
winston.error('[sso-oauth] Could not remove OAuthId data for uid ' + uid + '. Error: ' + err);
winston.error('[sso-oauth] Could not remove OAuthId data for uid ' + data.uid + '. Error: ' + err);
return callback(err);
}
callback(null, uid);
callback(null, data);
});
};

View File

@ -5,7 +5,7 @@
"url": "https://github.com/julianlam/nodebb-plugin-sso-oauth",
"library": "./library.js",
"hooks": [
{ "hook": "filter:user.delete", "method": "deleteUserData" },
{ "hook": "static:user.delete", "method": "deleteUserData" },
{ "hook": "filter:auth.init", "method": "getStrategy" }
]
}