mirror of https://github.com/home-assistant/core
Ring OTP improvement (#30688)
* Fix otp flow * Update Ring to 0.5 Co-authored-by: steve-gombos <3118886+steve-gombos@users.noreply.github.com>
This commit is contained in:
parent
b383a5195f
commit
c00af14ee2
|
@ -1,7 +1,7 @@
|
|||
"""Config flow for Ring integration."""
|
||||
import logging
|
||||
|
||||
from oauthlib.oauth2 import AccessDeniedError
|
||||
from oauthlib.oauth2 import AccessDeniedError, MissingTokenError
|
||||
from ring_doorbell import Auth
|
||||
import voluptuous as vol
|
||||
|
||||
|
@ -15,18 +15,14 @@ _LOGGER = logging.getLogger(__name__)
|
|||
async def validate_input(hass: core.HomeAssistant, data):
|
||||
"""Validate the user input allows us to connect."""
|
||||
|
||||
def otp_callback():
|
||||
if "2fa" in data:
|
||||
return data["2fa"]
|
||||
|
||||
raise Require2FA
|
||||
|
||||
auth = Auth()
|
||||
|
||||
try:
|
||||
token = await hass.async_add_executor_job(
|
||||
auth.fetch_token, data["username"], data["password"], otp_callback,
|
||||
auth.fetch_token, data["username"], data["password"], data.get("2fa"),
|
||||
)
|
||||
except MissingTokenError:
|
||||
raise Require2FA
|
||||
except AccessDeniedError:
|
||||
raise InvalidAuth
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"domain": "ring",
|
||||
"name": "Ring",
|
||||
"documentation": "https://www.home-assistant.io/integrations/ring",
|
||||
"requirements": ["ring_doorbell==0.4.0"],
|
||||
"requirements": ["ring_doorbell==0.5.0"],
|
||||
"dependencies": ["ffmpeg"],
|
||||
"codeowners": [],
|
||||
"config_flow": true
|
||||
|
|
|
@ -1753,7 +1753,7 @@ rfk101py==0.0.1
|
|||
rflink==0.0.50
|
||||
|
||||
# homeassistant.components.ring
|
||||
ring_doorbell==0.4.0
|
||||
ring_doorbell==0.5.0
|
||||
|
||||
# homeassistant.components.fleetgo
|
||||
ritassist==0.9.2
|
||||
|
|
|
@ -567,7 +567,7 @@ restrictedpython==5.0
|
|||
rflink==0.0.50
|
||||
|
||||
# homeassistant.components.ring
|
||||
ring_doorbell==0.4.0
|
||||
ring_doorbell==0.5.0
|
||||
|
||||
# homeassistant.components.yamaha
|
||||
rxv==0.6.0
|
||||
|
|
Loading…
Reference in New Issue