@lucidcms/core
Version:
The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.
1 lines • 2.66 kB
Source Map (JSON)
{"version":3,"file":"verify-reset-password.mjs","names":["userTokenServices.getSingle","constants"],"sources":["../../../../../src/libs/http/controllers/account/verify-reset-password.ts"],"sourcesContent":["import { createFactory } from \"hono/factory\";\nimport { describeRoute } from \"hono-openapi\";\nimport constants from \"../../../../constants/constants.js\";\nimport { controllerSchemas } from \"../../../../schemas/account.js\";\nimport { userTokenServices } from \"../../../../services/index.js\";\nimport { LucidAPIError } from \"../../../../utils/errors/index.js\";\nimport serviceWrapper from \"../../../../utils/services/service-wrapper.js\";\nimport { copy } from \"../../../i18n/index.js\";\nimport validate from \"../../middleware/validate.js\";\nimport openAPI from \"../../openapi/index.js\";\nimport createServiceContext from \"../../utils/create-service-context.js\";\n\nconst factory = createFactory();\n\nconst verifyResetPasswordController = factory.createHandlers(\n\tdescribeRoute({\n\t\tdescription: \"Verifies the password reset token is valid.\",\n\t\ttags: [\"account\"],\n\t\tsummary: \"Verify Reset Token\",\n\t\tresponses: openAPI.responses(),\n\t\tparameters: openAPI.parameters({\n\t\t\tparams: controllerSchemas.verifyResetPassword.params,\n\t\t}),\n\t}),\n\tvalidate(\"param\", controllerSchemas.verifyResetPassword.params),\n\tasync (c) => {\n\t\tconst { token } = c.req.valid(\"param\");\n\t\tconst context = createServiceContext(c);\n\n\t\tconst tokenResult = await serviceWrapper(userTokenServices.getSingle, {\n\t\t\ttransaction: false,\n\t\t\tdefaultError: {\n\t\t\t\ttype: \"basic\",\n\t\t\t\tname: copy(\"server:core.routes.verify.password.reset.error.name\"),\n\t\t\t\tmessage: copy(\"server:core.routes.verify.password.reset.error.message\"),\n\t\t\t},\n\t\t})(context, {\n\t\t\ttokenType: constants.userTokens.passwordReset,\n\t\t\ttoken: token,\n\t\t});\n\n\t\tif (tokenResult.error) throw new LucidAPIError(tokenResult.error);\n\n\t\tc.status(204);\n\t\treturn c.body(null);\n\t},\n);\n\nexport default verifyResetPasswordController;\n"],"mappings":"kkBAcA,MAAM,EAFU,EAE4B,CAAC,CAAC,eAC7C,EAAc,CACb,YAAa,8CACb,KAAM,CAAC,SAAS,EAChB,QAAS,qBACT,UAAW,EAAQ,UAAU,EAC7B,WAAY,EAAQ,WAAW,CAC9B,OAAQ,EAAkB,oBAAoB,MAC/C,CAAC,CACF,CAAC,EACD,EAAS,QAAS,EAAkB,oBAAoB,MAAM,EAC9D,KAAO,IAAM,CACZ,GAAM,CAAE,SAAU,EAAE,IAAI,MAAM,OAAO,EAC/B,EAAU,EAAqB,CAAC,EAEhC,EAAc,MAAM,EAAeA,EAA6B,CACrE,YAAa,GACb,aAAc,CACb,KAAM,QACN,KAAM,EAAK,qDAAqD,EAChE,QAAS,EAAK,wDAAwD,CACvE,CACD,CAAC,CAAC,CAAC,EAAS,CACX,UAAWC,EAAU,WAAW,cACzB,OACR,CAAC,EAED,GAAI,EAAY,MAAO,MAAM,IAAI,EAAc,EAAY,KAAK,EAGhE,OADA,EAAE,OAAO,GAAG,EACL,EAAE,KAAK,IAAI,CACnB,CACD"}