2
1
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2023-12-13 21:00:40 +01:00

Added Personal Token removal when a user is deleted

no issue
This commit is contained in:
Thibaut Patel 2020-11-16 15:50:59 +01:00
parent 4edccfd2f7
commit d48febbbd8

View file

@ -156,6 +156,20 @@ module.exports = {
frame.options.transacting = t;
return models.Post.destroyByAuthor(frame.options)
.then(() => {
return models.ApiKey.destroy({
...frame.options,
require: true,
destroyBy: {
user_id: frame.options.id
}
}).catch((err) => {
if (err instanceof models.ApiKey.NotFoundError) {
return; //Do nothing here as it's ok
}
throw err;
});
})
.then(() => {
return models.User.destroy(Object.assign({status: 'all'}, frame.options));
})