{"version":3,"file":"change-password.mjs","sources":["../../../../../server/graphql/mutations/auth/change-password.js"],"sourcesContent":["'use strict';\n\nconst { toPlainObject } = require('lodash/fp');\n\nconst { checkBadRequest } = require('../../utils');\n\nmodule.exports = ({ nexus, strapi }) => {\n const { nonNull } = nexus;\n\n return {\n type: 'UsersPermissionsLoginPayload',\n\n args: {\n currentPassword: nonNull('String'),\n password: nonNull('String'),\n passwordConfirmation: nonNull('String'),\n },\n\n description: 'Change user password. Confirm with the current password.',\n\n async resolve(parent, args, context) {\n const { koaContext } = context;\n\n koaContext.request.body = toPlainObject(args);\n\n await strapi.plugin('users-permissions').controller('auth').changePassword(koaContext);\n\n const output = koaContext.body;\n\n checkBadRequest(output);\n\n return {\n user: output.user || output,\n jwt: output.jwt,\n };\n },\n };\n};\n"],"names":["toPlainObject","require$$0","checkBadRequest","require$$1","changePassword","nexus","strapi","nonNull","type","args","currentPassword","password","passwordConfirmation","description","resolve","parent","context","koaContext","request","body","plugin","controller","output","user","jwt"],"mappings":";;;;;;;;IAEA,MAAM,EAAEA,aAAa,EAAE,GAAGC,UAAAA;IAE1B,MAAM,EAAEC,eAAe,EAAE,GAAGC,YAAAA,EAAAA;AAE5BC,IAAAA,cAAAA,GAAiB,CAAC,EAAEC,KAAK,EAAEC,MAAM,EAAE,GAAA;QACjC,MAAM,EAAEC,OAAO,EAAE,GAAGF,KAAAA;QAEpB,OAAO;YACLG,IAAM,EAAA,8BAAA;YAENC,IAAM,EAAA;AACJC,gBAAAA,eAAAA,EAAiBH,OAAQ,CAAA,QAAA,CAAA;AACzBI,gBAAAA,QAAAA,EAAUJ,OAAQ,CAAA,QAAA,CAAA;AAClBK,gBAAAA,oBAAAA,EAAsBL,OAAQ,CAAA,QAAA;AAC/B,aAAA;YAEDM,WAAa,EAAA,0DAAA;AAEb,YAAA,MAAMC,OAAQC,CAAAA,CAAAA,MAAM,EAAEN,IAAI,EAAEO,OAAO,EAAA;gBACjC,MAAM,EAAEC,UAAU,EAAE,GAAGD,OAAAA;AAEvBC,gBAAAA,UAAAA,CAAWC,OAAO,CAACC,IAAI,GAAGnB,aAAcS,CAAAA,IAAAA,CAAAA;gBAExC,MAAMH,MAAAA,CAAOc,MAAM,CAAC,mBAAA,CAAA,CAAqBC,UAAU,CAAC,MAAA,CAAA,CAAQjB,cAAc,CAACa,UAAAA,CAAAA;gBAE3E,MAAMK,MAAAA,GAASL,WAAWE,IAAI;gBAE9BjB,eAAgBoB,CAAAA,MAAAA,CAAAA;gBAEhB,OAAO;oBACLC,IAAMD,EAAAA,MAAAA,CAAOC,IAAI,IAAID,MAAAA;AACrBE,oBAAAA,GAAAA,EAAKF,OAAOE;AACpB,iBAAA;AACK;AACL,SAAA;AACA,KAAA;;;;;;"}