Skip to content

Commit

Permalink
Handle login failure
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Soltys committed Dec 8, 2012
1 parent ca2b9a3 commit a7dd1c9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions passport.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)
))

Expand Down

0 comments on commit a7dd1c9

Please sign in to comment.