mirror of
https://github.com/strapi/strapi.git
synced 2025-07-13 12:02:10 +00:00
40 lines
798 B
JavaScript
40 lines
798 B
JavaScript
![]() |
'use strict';
|
||
|
|
||
|
const { toPlainObject } = require('lodash/fp');
|
||
|
|
||
|
const { checkBadRequest } = require('../../utils');
|
||
|
|
||
|
module.exports = ({ nexus, strapi }) => {
|
||
|
const { nonNull } = nexus;
|
||
|
|
||
|
return {
|
||
|
type: 'UsersPermissionsLoginPayload',
|
||
|
|
||
|
args: {
|
||
|
confirmation: nonNull('String'),
|
||
|
},
|
||
|
|
||
|
description: 'Confirm an email users email address',
|
||
|
|
||
|
async resolve(parent, args, context) {
|
||
|
const { koaContext } = context;
|
||
|
|
||
|
koaContext.query = toPlainObject(args);
|
||
|
|
||
|
await strapi
|
||
|
.plugin('users-permissions')
|
||
|
.controller('auth')
|
||
|
.emailConfirmation(koaContext, null, true);
|
||
|
|
||
|
const output = koaContext.body;
|
||
|
|
||
|
checkBadRequest(output);
|
||
|
|
||
|
return {
|
||
|
user: output.user || output,
|
||
|
jwt: output.jwt,
|
||
|
};
|
||
|
},
|
||
|
};
|
||
|
};
|