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

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -