Add valid_window=1 to TOTP verify ()

pull/18705/head
Jason Hu 2018-09-15 04:28:25 -07:00 committed by Paulus Schoutsen
parent cc38981a38
commit 34deaf8849
1 changed files with 2 additions and 2 deletions
homeassistant/auth/mfa_modules

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):