Feature: add a 30 seconds grace window for 2-factor token checks

This commit is contained in:
Jeff Wong 2018-05-15 16:13:21 -07:00
parent 19605e8b0b
commit 74aecdfd9d
1 changed files with 1 additions and 1 deletions

View File

@ -27,7 +27,7 @@ module SecondFactorManager
last_used = self.user_second_factor.last_used.to_i
end
authenticated = !token.blank? && totp.verify_with_drift_and_prior(token, 0, last_used)
authenticated = !token.blank? && totp.verify_with_drift_and_prior(token, 30, last_used)
self.user_second_factor.update!(last_used: DateTime.now) if authenticated
!!authenticated
end