Fixing user details exposure in articles example

This commit is contained in:
Amos Haviv
2013-09-29 15:42:12 +03:00
parent 2cab7b72b3
commit 0cfbafaa7c
2 changed files with 2 additions and 2 deletions

View File

@@ -80,7 +80,7 @@ exports.show = function(req, res) {
* List of Articles
*/
exports.all = function(req, res) {
Article.find().sort('-created').populate('user').exec(function(err, articles) {
Article.find().sort('-created').populate('user', 'name username').exec(function(err, articles) {
if (err) {
res.render('error', {
status: 500

View File

@@ -44,7 +44,7 @@ ArticleSchema.statics = {
load: function(id, cb) {
this.findOne({
_id: id
}).populate('user').exec(cb);
}).populate('user', 'name username').exec(cb);
}
};