summaryrefslogtreecommitdiff
path: root/lib/web/auth
diff options
context:
space:
mode:
authorClaudius2019-05-13 11:51:05 +0200
committerClaudius2019-05-13 19:37:21 +0200
commit1d403e183d50001bf0f20113d15994007b14696b (patch)
tree8942eb0c2dd344691bf3d2eaf6a524bbd3095707 /lib/web/auth
parentdf666dd2140c8955765972230260d6e4bd5de42a (diff)
asyncified setting and verifying the password
Signed-off-by: Claudius <opensource@amenthes.de>
Diffstat (limited to 'lib/web/auth')
-rw-r--r--lib/web/auth/email/index.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/web/auth/email/index.js b/lib/web/auth/email/index.js
index f7e58d46..daa4a8c5 100644
--- a/lib/web/auth/email/index.js
+++ b/lib/web/auth/email/index.js
@@ -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)