fix bug in server side checking for username, closes #219
This commit is contained in:
@ -322,7 +322,6 @@ exports.updateProgress = function(req, res) {
|
|||||||
|
|
||||||
exports.postUpdateProfile = function(req, res, next) {
|
exports.postUpdateProfile = function(req, res, next) {
|
||||||
|
|
||||||
// What does this do?
|
|
||||||
User.findById(req.user.id, function(err, user) {
|
User.findById(req.user.id, function(err, user) {
|
||||||
if (err) return next(err);
|
if (err) return next(err);
|
||||||
var errors = req.validationErrors();
|
var errors = req.validationErrors();
|
||||||
@ -342,7 +341,7 @@ exports.postUpdateProfile = function(req, res, next) {
|
|||||||
});
|
});
|
||||||
return res.redirect('/account');
|
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) {
|
if (err) {
|
||||||
return next(err);
|
return next(err);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user