From 28b8aa896bd611ebd02fed98fe5020529dea1a40 Mon Sep 17 00:00:00 2001 From: arnaucode Date: Sun, 29 Jan 2017 20:02:57 +0100 Subject: [PATCH] updated --- controllers/userController.js | 4 +++- models/userModel.js | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/controllers/userController.js b/controllers/userController.js index c172567..411f0d8 100644 --- a/controllers/userController.js +++ b/controllers/userController.js @@ -47,7 +47,9 @@ exports.login = function(req, res) { // find the user userModel.findOne({ username: req.body.username - }, function(err, user) { + }) + .select('+password') + .exec(function(err, user) { if (err) throw err; diff --git a/models/userModel.js b/models/userModel.js index 30505a5..4398c0c 100644 --- a/models/userModel.js +++ b/models/userModel.js @@ -6,8 +6,8 @@ var mongooseUniqueValidator = require('mongoose-unique-validator'); var userSchema = new Schema({ username: { type: String, required: true, unique: true }, - password: { type: String, required: true, selected: false }, - token: { type: String, selected: false }, + password: { type: String, required: true, select: false }, + token: { type: String, select: false }, description: { type: String, default: "Hello world" }, avatar: { type: String, default: "img/avatars/racoon.png" }, faircoin: { type: String, default: "img/faircoinpublickey_sample.png" },