mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
feat(cli): notify external hooks about user profile and password changes (#3919)
This commit is contained in:
committed by
GitHub
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 };
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user