Skip to content

Commit

Permalink
feat(cli): notify external hooks about user profile and password chan…
Browse files Browse the repository at this point in the history
…ges (#3919)
  • Loading branch information
netroy authored Aug 24, 2022
1 parent 2d6eea8 commit 7d74dda
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/cli/src/UserManagement/routes/me.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export function meNamespace(this: N8nApp): void {
throw new ResponseHelper.ResponseError('Invalid email address', undefined, 400);
}

const { email: currentEmail } = req.user;
const newUser = new User();

Object.assign(newUser, req.user, req.body);
Expand All @@ -65,6 +66,7 @@ export function meNamespace(this: N8nApp): void {
user_id: req.user.id,
fields_changed: updatedkeys,
});
await this.externalHooks.run('user.profile.update', [ currentEmail, req.body ]);

return sanitizeUser(user);
},
Expand Down Expand Up @@ -110,6 +112,8 @@ export function meNamespace(this: N8nApp): void {
fields_changed: ['password'],
});

await this.externalHooks.run('user.password.update', [ user.email, req.user.password ]);

return { success: true };
}),
);
Expand Down

0 comments on commit 7d74dda

Please sign in to comment.