model - Exclude password from sails user association -


I refer to the user model in many of my object associations. How can I remove the password field by default or by force?

For example Post.findOne (). Populate ('Author') ... will generate the author's encrypted password ...!

Edit 1 - 1 solution I found:

In the model, the toJSON writes to override the method:

< Code> toJSON: function () {var obj = this.toObject (); Remove obj.password; Return obj; },

See the Waterlines document:


Comments