fix: allows _verificationToken to come back via showHiddenFields

This commit is contained in:
James
2021-04-21 12:22:09 -04:00
parent d23f7f980d
commit 74430ea151
2 changed files with 2 additions and 2 deletions

View File

@@ -69,7 +69,7 @@ const traverseFields = (args: Arguments): void => {
fields.forEach((field) => {
const dataCopy = data;
if (operation === 'read' && field.hidden && typeof data[field.name] !== 'undefined' && !showHiddenFields) {
if (hook === 'afterRead' && field.hidden && typeof data[field.name] !== 'undefined' && !showHiddenFields) {
delete data[field.name];
}

View File

@@ -1,4 +1,4 @@
const internalFields = ['_id', '__v', 'salt', 'hash', '_verificationToken'];
const internalFields = ['_id', '__v', 'salt', 'hash'];
const removeInternalFields = (incomingDoc) => Object.entries(incomingDoc).reduce((newDoc, [key, val]) => {
if (internalFields.indexOf(key) > -1) {