fix(cli): password reset should trigger internal and external hooks (#4066)

Ticket: N8N-4586
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™ 2022-09-09 14:01:48 +02:00 committed by GitHub
parent eebc51ec7c
commit 12507d39d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View file

@ -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]);
}),
);
}

View file

@ -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();
}