mirror of
https://github.com/strapi/strapi.git
synced 2025-08-28 10:45:51 +00:00
Allow query params for /me
This commit is contained in:
parent
291e2b6835
commit
64852e9cda
@ -95,7 +95,6 @@ module.exports = {
|
|||||||
throw new NotFoundError(`User not found`);
|
throw new NotFoundError(`User not found`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
await validateUpdateUserBody(ctx.request.body);
|
await validateUpdateUserBody(ctx.request.body);
|
||||||
|
|
||||||
if (user.provider === 'local' && _.has(ctx.request.body, 'password') && !password) {
|
if (user.provider === 'local' && _.has(ctx.request.body, 'password') && !password) {
|
||||||
@ -186,12 +185,15 @@ module.exports = {
|
|||||||
* @return {Object|Array}
|
* @return {Object|Array}
|
||||||
*/
|
*/
|
||||||
async me(ctx) {
|
async me(ctx) {
|
||||||
const user = ctx.state.user;
|
const authUser = ctx.state.user;
|
||||||
|
const { query } = ctx;
|
||||||
|
|
||||||
if (!user) {
|
if (!authUser) {
|
||||||
return ctx.unauthorized();
|
return ctx.unauthorized();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const user = await getService('user').fetch(authUser.id, query);
|
||||||
|
|
||||||
ctx.body = await sanitizeOutput(user, ctx);
|
ctx.body = await sanitizeOutput(user, ctx);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -14,7 +14,6 @@ module.exports = [
|
|||||||
path: '/users',
|
path: '/users',
|
||||||
handler: 'user.find',
|
handler: 'user.find',
|
||||||
config: {
|
config: {
|
||||||
auth: {},
|
|
||||||
prefix: '',
|
prefix: '',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user