diff --git a/helm/configs/backend/login-callbacks.js b/helm/configs/backend/login-callbacks.js index 0684f9c..4789554 100644 --- a/helm/configs/backend/login-callbacks.js +++ b/helm/configs/backend/login-callbacks.js @@ -2,7 +2,12 @@ exports.accessGroupsToProfile = function (req, done) { - return function (err, user, identity, token) { + return async function (err, user, identity, token) { + await user.identities.destroyAll({and: [ + {provider: identity.provider}, + {id: {neq: identity.id}}, + {userId: user.id} + ]}); identity.updateAttributes({ "profile": { accessGroups: identity.profile._json.pgroups,