diff --git a/library.js b/library.js index 4de7467..ae2b4db 100644 --- a/library.js +++ b/library.js @@ -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); }); }; diff --git a/plugin.json b/plugin.json index aff7ca6..32cf782 100644 --- a/plugin.json +++ b/plugin.json @@ -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" } ] }