mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Added Personal Token removal when a user is deleted
no issue
This commit is contained in:
parent
4edccfd2f7
commit
d48febbbd8
1 changed files with 14 additions and 0 deletions
|
@ -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));
|
||||
})
|
||||
|
|
Loading…
Add table
Reference in a new issue