From a7dd1c98fad7f39047dd917a07d5791513a75405 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 7 Dec 2012 11:12:22 -0800 Subject: [PATCH] Handle login failure --- passport.coffee | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/passport.coffee b/passport.coffee index 05a4c68c..426c4db7 100644 --- a/passport.coffee +++ b/passport.coffee @@ -17,13 +17,18 @@ passport.deserializeUser((username, done) -> passport.use(new LocalStrategy( (username, password, done) -> db.hget(username, 'password', (err, hash) -> + return done(err) if err if hash bcrypt.compare(password, hash, (err, match) -> if match db.hgetall(username, (err, user) -> return done(null, user) ) + else + return done(null, false) ) + else + return done(null, false) ) ))