set hide option for salt and hash in auth collections

This commit is contained in:
Dan Ribbens
2020-08-23 16:07:06 -04:00
parent 063b3b86c8
commit 95352f47ea
2 changed files with 12242 additions and 1 deletions

View File

@@ -2,7 +2,7 @@ const mongoose = require('mongoose');
const express = require('express');
const mongooseHidden = require('mongoose-hidden')({
hidden: {
salt: true, hash: true, _id: true, __v: true,
_id: true, __v: true,
},
applyRecursively: true,
});
@@ -21,6 +21,8 @@ function registerCollections() {
if (collection.auth) {
schema.plugin(passportLocalMongoose, { usernameField: 'email' });
schema.path('hash').options.hide = true;
schema.path('salt').options.hide = true;
}
schema.plugin(mongooseHidden);