fix bug in server side checking for username, closes #219

This commit is contained in:
Nathan Leniz
2015-03-18 07:15:25 +09:00
parent c9dd6366ec
commit 514b5ea572

View File

@ -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);
}