UNPKG

payload

Version:

Node, React, Headless CMS and Application Framework built on Next.js

46 lines (45 loc) 1.24 kB
import { defaultAccess } from '../defaultAccess.js'; const autoRemoveVerificationToken = ({ data, operation, originalDoc, value })=>{ // If a user manually sets `_verified` to true, // and it was `false`, set _verificationToken to `null`. // This is useful because the admin panel // allows users to set `_verified` to true manually if (operation === 'update') { if (data?._verified === true && originalDoc?._verified === false) { return null; } } return value; }; export const verificationFields = [ { name: '_verified', type: 'checkbox', access: { create: defaultAccess, read: defaultAccess, update: defaultAccess }, admin: { components: { Field: false } }, label: ({ t })=>t('authentication:verified') }, { name: '_verificationToken', type: 'text', access: { create: ()=>false, update: ()=>false }, hidden: true, hooks: { beforeChange: [ autoRemoveVerificationToken ] } } ]; //# sourceMappingURL=verification.js.map