From 514b5ea572fb22e579fd7b302c977e6fe9111c29 Mon Sep 17 00:00:00 2001 From: Nathan Leniz Date: Wed, 18 Mar 2015 07:15:25 +0900 Subject: [PATCH] fix bug in server side checking for username, closes #219 --- controllers/user.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/controllers/user.js b/controllers/user.js index f6651d6d2c..d6960891c7 100644 --- a/controllers/user.js +++ b/controllers/user.js @@ -322,7 +322,6 @@ exports.updateProgress = function(req, res) { exports.postUpdateProfile = function(req, res, next) { - // What does this do? User.findById(req.user.id, function(err, user) { if (err) return next(err); var errors = req.validationErrors(); @@ -342,7 +341,7 @@ exports.postUpdateProfile = function(req, res, next) { }); return res.redirect('/account'); } - User.findOne({ username: req.body.username }, function(err, existingUsername) { + User.findOne({ 'profile.username': req.body.username }, function(err, existingUsername) { if (err) { return next(err); }