Skip to content

Commit

Permalink
fix(cli): password reset should trigger internal and external hooks (#…
Browse files Browse the repository at this point in the history
…4066)

Ticket: N8N-4586
  • Loading branch information
netroy committed Sep 9, 2022
1 parent eebc51e commit 12507d3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions packages/cli/src/UserManagement/routes/passwordReset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,13 @@ export function passwordResetNamespace(this: N8nApp): void {
Logger.info('User password updated successfully', { userId });

await issueCookie(res, user);

void InternalHooksManager.getInstance().onUserUpdate({
user_id: userId,
fields_changed: ['password'],
});

await this.externalHooks.run('user.password.update', [user.email, password]);
}),
);
}
3 changes: 2 additions & 1 deletion packages/cli/test/integration/shared/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ export async function initTestServer({
if (
endpointGroups.includes('credentials') ||
endpointGroups.includes('me') ||
endpointGroups.includes('users')
endpointGroups.includes('users') ||
endpointGroups.includes('passwordReset')
) {
testServer.externalHooks = ExternalHooks();
}
Expand Down

0 comments on commit 12507d3

Please sign in to comment.