mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 03:37:07 +00:00
Add valid_window=1 to TOTP verify (#16625)
This commit is contained in:
parent
cc38981a38
commit
34deaf8849
@ -149,10 +149,10 @@ class TotpAuthModule(MultiFactorAuthModule):
|
|||||||
if ota_secret is None:
|
if ota_secret is None:
|
||||||
# even we cannot find user, we still do verify
|
# even we cannot find user, we still do verify
|
||||||
# to make timing the same as if user was found.
|
# 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 False
|
||||||
|
|
||||||
return bool(pyotp.TOTP(ota_secret).verify(code))
|
return bool(pyotp.TOTP(ota_secret).verify(code, valid_window=1))
|
||||||
|
|
||||||
|
|
||||||
class TotpSetupFlow(SetupFlow):
|
class TotpSetupFlow(SetupFlow):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user