Add valid_window=1 to TOTP verify (#16625)

This commit is contained in:
Jason Hu 2018-09-15 04:28:25 -07:00 committed by Paulus Schoutsen
parent cc38981a38
commit 34deaf8849

View File

@ -149,10 +149,10 @@ class TotpAuthModule(MultiFactorAuthModule):
if ota_secret is None:
# even we cannot find user, we still do verify
# to make timing the same as if user was found.
pyotp.TOTP(DUMMY_SECRET).verify(code)
pyotp.TOTP(DUMMY_SECRET).verify(code, valid_window=1)
return False
return bool(pyotp.TOTP(ota_secret).verify(code))
return bool(pyotp.TOTP(ota_secret).verify(code, valid_window=1))
class TotpSetupFlow(SetupFlow):