diff --git a/app/controllers/users/users.password.server.controller.js b/app/controllers/users/users.password.server.controller.js index fe5ee8ca..209125b1 100755 --- a/app/controllers/users/users.password.server.controller.js +++ b/app/controllers/users/users.password.server.controller.js @@ -31,7 +31,10 @@ exports.forgot = function(req, res, next) { function(token, done) { if (req.body.username) { User.findOne({ - username: req.body.username + $or: [ + {'username': req.body.username}, + {'email': req.body.username} + ] }, '-salt -password', function(err, user) { if(err){ return res.status(500).send({ @@ -40,7 +43,7 @@ exports.forgot = function(req, res, next) { } if (!user) { return res.status(400).send({ - message: 'No account with that username has been found' + message: 'No account with that username or email has been found' }); } else if (user.provider !== 'local') { return res.status(400).send({ diff --git a/config/passport_helpers.js b/config/passport_helpers.js index 6ee77de6..5ca856e1 100644 --- a/config/passport_helpers.js +++ b/config/passport_helpers.js @@ -6,7 +6,6 @@ var passport = require("passport"); var User = require('mongoose').model('User'); module.exports.isAuthenticatedOrApiKey = function isAuthenticated(req, res, next) { - debugger; if (req.isAuthenticated()) { return next(); } else {