diff --git a/src/passport/index.js b/src/passport/index.js index e6a9116cb..7b57ecda4 100644 --- a/src/passport/index.js +++ b/src/passport/index.js @@ -38,7 +38,7 @@ module.exports = function () { passReqToCallback: true }, function (req, username, password, done) { - User.findOne({ username: new RegExp('^' + username + '$', 'i') }) + User.findOne({ username: new RegExp('^' + username.trim() + '$', 'i') }) .select('+password +tOTPKey +tOTPPeriod') .exec(function (err, user) { if (err) {