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

Popular posts from this blog

HTML/CSS - Automatically set height width from background image? -

php - Mysql Show Process - Sleep Commands and what to do -

c - What is the address of buf (the local variable in the main function)? -