Only allow registeration with specific fields

Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
Co-authored-by: diogotcorreia
This commit is contained in:
Alexandre Bodin 2020-05-05 14:41:30 +02:00
parent 6a6d53b402
commit a927f7e19b

View File

@ -394,9 +394,10 @@ module.exports = {
);
}
const params = _.assign(ctx.request.body, {
const params = {
..._.pick(ctx.request.body, ['username', 'email', 'password']),
provider: 'local',
});
};
// Password is required.
if (!params.password) {
@ -580,14 +581,14 @@ module.exports = {
{ confirmed: true }
);
if(returnUser) {
if (returnUser) {
ctx.send({
jwt: strapi.plugins['users-permissions'].services.jwt.issue({
id: user.id
id: user.id,
}),
user: sanitizeEntity(user.toJSON ? user.toJSON() : user, {
model: strapi.query('user', 'users-permissions').model
})
model: strapi.query('user', 'users-permissions').model,
}),
});
} else {
const settings = await strapi