UNPKG

@lucidcms/core

Version:

The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.

2 lines 731 B
import{copy as e}from"../../libs/i18n/copy.mjs";import t from"../../libs/repositories/user-tokens.mjs";import n from"../../utils/helpers/hash-user-token.mjs";const r=async(r,i)=>{let a=new t(r.db.client,r.config.db),o=n(i.token),s=await a.selectSingle({select:[`id`,`user_id`],where:[{key:`token`,operator:`=`,value:o},{key:`token_type`,operator:`=`,value:i.tokenType},{key:`expiry_date`,operator:`>`,value:new Date().toISOString()},{key:`revoked_at`,operator:`is`,value:null},{key:`consumed_at`,operator:`is`,value:null}],validation:{enabled:!0,defaultError:{message:e(`server:core.tokens.not.found.message`),status:404}}});return s.error?s:{error:void 0,data:s.data}};export{r as default}; //# sourceMappingURL=get-single.mjs.map