Skip to content
This repository has been archived by the owner on Jun 12, 2018. It is now read-only.

Commit

Permalink
Merge pull request #293 from clochix/master
Browse files Browse the repository at this point in the history
Fix error with 2FA recovery code, refs #292
  • Loading branch information
nono authored Jul 11, 2016
2 parents d44b4b0 + 5390d84 commit 2eba08d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion server/middlewares/authentication.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ disableRecoveryCode = (user, codes, index, callback) ->

attemptRecoveryCodes = (user, req, res, next) ->
User.first (err, user) ->
codes = JSON.parse(user.encryptedRecoveryCodes)
if err
next makeError 401, 'no user found', err
else if not user.encryptedRecoveryCodes?
next makeError 401, 'error otp invalid code'
else
codes = JSON.parse(user.encryptedRecoveryCodes)
index = codes.indexOf(parseInt req.body.authcode)
if index is -1 # invalid code
next makeError 401, 'error otp invalid code'
Expand Down

0 comments on commit 2eba08d

Please sign in to comment.