Moved logic to the right controller

This commit is contained in:
Convly 2022-05-13 11:33:25 +02:00
parent bb87e910b2
commit 510b54f16e
2 changed files with 5 additions and 7 deletions

View File

@ -124,16 +124,10 @@ module.exports = {
strapi.telemetry.send('didCreateFirstAdmin');
const sanitizedUser = getService('user').sanitizeUser(user);
// Note: We need to assign manually the registrationToken to the
// final user payload so that it's not removed in the sanitation process.
Object.assign(sanitizedUser, { registrationToken: user.registrationToken });
ctx.body = {
data: {
token: getService('token').createJwtToken(user),
user: sanitizedUser,
user: getService('user').sanitizeUser(user),
},
};
},

View File

@ -36,6 +36,10 @@ module.exports = {
const userInfo = getService('user').sanitizeUser(createdUser);
// Note: We need to assign manually the registrationToken to the
// final user payload so that it's not removed in the sanitation process.
Object.assign(userInfo, { registrationToken: createdUser.registrationToken });
// Send 201 created
ctx.created({ data: userInfo });
},