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:
Drew Town 2020-05-25 09:39:33 -06:00 committed by GitHub
parent 65cc815a18
commit 549803adfc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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) {