mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-21 02:56:40 -08:00
feat(cli): notify external hooks about user profile and password changes (#3919)
This commit is contained in:
parent
2d6eea82d3
commit
7d74ddab29
|
@ -48,6 +48,7 @@ export function meNamespace(this: N8nApp): void {
|
||||||
throw new ResponseHelper.ResponseError('Invalid email address', undefined, 400);
|
throw new ResponseHelper.ResponseError('Invalid email address', undefined, 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { email: currentEmail } = req.user;
|
||||||
const newUser = new User();
|
const newUser = new User();
|
||||||
|
|
||||||
Object.assign(newUser, req.user, req.body);
|
Object.assign(newUser, req.user, req.body);
|
||||||
|
@ -65,6 +66,7 @@ export function meNamespace(this: N8nApp): void {
|
||||||
user_id: req.user.id,
|
user_id: req.user.id,
|
||||||
fields_changed: updatedkeys,
|
fields_changed: updatedkeys,
|
||||||
});
|
});
|
||||||
|
await this.externalHooks.run('user.profile.update', [ currentEmail, req.body ]);
|
||||||
|
|
||||||
return sanitizeUser(user);
|
return sanitizeUser(user);
|
||||||
},
|
},
|
||||||
|
@ -110,6 +112,8 @@ export function meNamespace(this: N8nApp): void {
|
||||||
fields_changed: ['password'],
|
fields_changed: ['password'],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await this.externalHooks.run('user.password.update', [ user.email, req.user.password ]);
|
||||||
|
|
||||||
return { success: true };
|
return { success: true };
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue