From 84f2168769f85fac2def4ea52a27278894fe5223 Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Wed, 10 Jun 2015 17:12:21 -0700 Subject: [PATCH] fix remove stray profile reference fix findOne queries should have where filter --- server/boot/user.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/server/boot/user.js b/server/boot/user.js index 9597fa8ac6..e2e4ec0494 100644 --- a/server/boot/user.js +++ b/server/boot/user.js @@ -261,7 +261,9 @@ module.exports = function(app) { return res.redirect('/account'); } - User.findOne({ email: req.body.email }, function(err, existingEmail) { + User.findOne({ + where: { email: req.body.email } + }, function(err, existingEmail) { if (err) { return next(err); } @@ -273,7 +275,7 @@ module.exports = function(app) { return res.redirect('/account'); } User.findOne( - { 'profile.username': req.body.username }, + { where: { username: req.body.username } }, function(err, existingUsername) { if (err) { return next(err); @@ -281,7 +283,7 @@ module.exports = function(app) { var user = req.user; if ( existingUsername && - existingUsername.profile.username !== user.username + existingUsername.username !== user.username ) { req.flash('errors', { msg: 'An account with that username already exists.' @@ -558,7 +560,7 @@ module.exports = function(app) { }, function(token, done) { User.findOne({ - email: req.body.email.toLowerCase() + where: { email: req.body.email.toLowerCase() } }, function(err, user) { if (err) { return done(err); } if (!user) {