mirror of
https://github.com/strapi/strapi.git
synced 2025-11-10 07:10:11 +00:00
Moved logic to the right controller
This commit is contained in:
parent
bb87e910b2
commit
510b54f16e
@ -124,16 +124,10 @@ module.exports = {
|
|||||||
|
|
||||||
strapi.telemetry.send('didCreateFirstAdmin');
|
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 = {
|
ctx.body = {
|
||||||
data: {
|
data: {
|
||||||
token: getService('token').createJwtToken(user),
|
token: getService('token').createJwtToken(user),
|
||||||
user: sanitizedUser,
|
user: getService('user').sanitizeUser(user),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|||||||
@ -36,6 +36,10 @@ module.exports = {
|
|||||||
|
|
||||||
const userInfo = getService('user').sanitizeUser(createdUser);
|
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
|
// Send 201 created
|
||||||
ctx.created({ data: userInfo });
|
ctx.created({ data: userInfo });
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user