From 8cfdd45de7e3bdef36775265448c9faed5c9428d Mon Sep 17 00:00:00 2001 From: Ludvig Janiuk Date: Thu, 2 Aug 2018 11:38:15 +0200 Subject: [PATCH] Whitelist filter. Fix #20 --- .gitignore | 6 ++++++ library.js | 6 ++++++ plugin.json | 1 + 3 files changed, 13 insertions(+) diff --git a/.gitignore b/.gitignore index d77e539..0637078 100644 --- a/.gitignore +++ b/.gitignore @@ -216,3 +216,9 @@ pip-log.txt sftp-config.json node_modules/ + +#################### +# JetBrains +#################### + +.idea diff --git a/library.js b/library.js index 3a49576..413edb3 100644 --- a/library.js +++ b/library.js @@ -264,5 +264,11 @@ }); }; + // If this filter is not there, the deleteUserData function will fail when getting the metryId for deletion. + OAuth.whitelistFields = function(params, callback) { + params.whitelist.push(constants.name + 'Id'); + callback(null, params); + }; + module.exports = OAuth; }(module)); diff --git a/plugin.json b/plugin.json index 32cf782..16db132 100644 --- a/plugin.json +++ b/plugin.json @@ -6,6 +6,7 @@ "library": "./library.js", "hooks": [ { "hook": "static:user.delete", "method": "deleteUserData" }, + { "hook": "filter:user.whitelistFields", "method": "whitelistFields" }, { "hook": "filter:auth.init", "method": "getStrategy" } ] }