diff options
Diffstat (limited to 'lib/web/auth/email')
-rw-r--r-- | lib/web/auth/email/index.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/web/auth/email/index.js b/lib/web/auth/email/index.js index f7e58d46..32e21428 100644 --- a/lib/web/auth/email/index.js +++ b/lib/web/auth/email/index.js @@ -7,8 +7,8 @@ const LocalStrategy = require('passport-local').Strategy const config = require('../../../config') const models = require('../../../models') const logger = require('../../../logger') -const {setReturnToFromReferer} = require('../utils') -const {urlencodedParser} = require('../../utils') +const { setReturnToFromReferer } = require('../utils') +const { urlencodedParser } = require('../../utils') const response = require('../../../response') let emailAuth = module.exports = Router() @@ -23,8 +23,14 @@ passport.use(new LocalStrategy({ } }).then(function (user) { if (!user) return done(null, false) - if (!user.verifyPassword(password)) return done(null, false) - return done(null, user) + user.verifyPassword(password).then(verified => { + if (verified) { + return done(null, user) + } else { + logger.warn('invalid password given for %s', user.email) + return done(null, false) + } + }) }).catch(function (err) { logger.error(err) return done(err) |