Skip to content

Commit

Permalink
fix(auth): fix auth code generation crashing
Browse files Browse the repository at this point in the history
  • Loading branch information
cberthou committed Sep 23, 2021
1 parent 23aa23b commit ea5f649
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/server/src/utils/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,11 @@ export default class Auth {

const authRequest = await authRequests.getByEmail(email);

return !isExpired(authRequest.created_at, config.get("authCode.expire")) &&
!tooMuchFailures(authRequest.failures, config.get("authCode.maxFailures"));
return authRequest && (
!isExpired(authRequest.created_at, config.get("authCode.expire")) &&
!tooMuchFailures(authRequest.failures, config.get("authCode.maxFailures")
)
);
}

static async generateCode(email) {
Expand Down

0 comments on commit ea5f649

Please sign in to comment.