mirror of
https://github.com/strapi/strapi.git
synced 2025-12-27 07:03:38 +00:00
Sanitize user object in user plugin update method return value (#6003)
* Sanitize user object in update method return value Signed-off-by: Drew Town <drew.town+github@gmail.com> * Sanitize returned user data on create and destroy
This commit is contained in:
parent
65cc815a18
commit
549803adfc
@ -149,7 +149,7 @@ module.exports = {
|
||||
try {
|
||||
const data = await strapi.plugins['users-permissions'].services.user.add(user);
|
||||
|
||||
ctx.created(data);
|
||||
ctx.created(sanitizeUser(data));
|
||||
} catch (error) {
|
||||
ctx.badRequest(null, formatError(error));
|
||||
}
|
||||
@ -230,7 +230,7 @@ module.exports = {
|
||||
|
||||
const data = await strapi.plugins['users-permissions'].services.user.edit({ id }, updateData);
|
||||
|
||||
ctx.send(data);
|
||||
ctx.send(sanitizeUser(data));
|
||||
},
|
||||
|
||||
/**
|
||||
@ -240,7 +240,7 @@ module.exports = {
|
||||
async destroy(ctx) {
|
||||
const { id } = ctx.params;
|
||||
const data = await strapi.plugins['users-permissions'].services.user.remove({ id });
|
||||
ctx.send(data);
|
||||
ctx.send(sanitizeUser(data));
|
||||
},
|
||||
|
||||
async destroyAll(ctx) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user