Skip to content

Commit

Permalink
Check for user existance
Browse files Browse the repository at this point in the history
  • Loading branch information
minottic committed Oct 25, 2024
1 parent 396db35 commit cf015d9
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions helm/configs/backend/login-callbacks.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
exports.accessGroupsToProfile =
function (req, done) {
return async function (err, user, identity, token) {
await user.identities.destroyAll({and: [
{provider: identity.provider},
{id: {neq: identity.id}},
{userId: user.id}
]});
if (user && user.identities)
await user.identities.destroyAll({and: [
{provider: identity.provider},
{id: {neq: identity.id}},
{userId: user.id}
]});
identity.updateAttributes({
"profile": {
accessGroups: identity.profile._json.pgroups,
Expand Down

0 comments on commit cf015d9

Please sign in to comment.