Add valid_window=1 to TOTP verify (#16625)

This commit is contained in:
Jason Hu authored and Paulus Schoutsen committed 2018-09-15 13:28:25 +02:00
1 parent cc38981a38
commit 34deaf8849
1 file changed
+2 -2
+2 -2
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):