mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Use new reauth helpers in webostv (#128823)
This commit is contained in:
parent
8ceecec5b8
commit
0ede15dcbf
@ -47,7 +47,6 @@ class FlowHandler(ConfigFlow, domain=DOMAIN):
|
|||||||
self._host: str = ""
|
self._host: str = ""
|
||||||
self._name: str = ""
|
self._name: str = ""
|
||||||
self._uuid: str | None = None
|
self._uuid: str | None = None
|
||||||
self._entry: ConfigEntry | None = None
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@callback
|
@callback
|
||||||
@ -144,15 +143,12 @@ class FlowHandler(ConfigFlow, domain=DOMAIN):
|
|||||||
) -> ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Perform reauth upon an WebOsTvPairError."""
|
"""Perform reauth upon an WebOsTvPairError."""
|
||||||
self._host = entry_data[CONF_HOST]
|
self._host = entry_data[CONF_HOST]
|
||||||
self._entry = self.hass.config_entries.async_get_entry(self.context["entry_id"])
|
|
||||||
return await self.async_step_reauth_confirm()
|
return await self.async_step_reauth_confirm()
|
||||||
|
|
||||||
async def async_step_reauth_confirm(
|
async def async_step_reauth_confirm(
|
||||||
self, user_input: dict[str, Any] | None = None
|
self, user_input: dict[str, Any] | None = None
|
||||||
) -> ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Dialog that informs the user that reauth is required."""
|
"""Dialog that informs the user that reauth is required."""
|
||||||
assert self._entry is not None
|
|
||||||
|
|
||||||
if user_input is not None:
|
if user_input is not None:
|
||||||
try:
|
try:
|
||||||
client = await async_control_connect(self._host, None)
|
client = await async_control_connect(self._host, None)
|
||||||
@ -161,8 +157,9 @@ class FlowHandler(ConfigFlow, domain=DOMAIN):
|
|||||||
except WEBOSTV_EXCEPTIONS:
|
except WEBOSTV_EXCEPTIONS:
|
||||||
return self.async_abort(reason="reauth_unsuccessful")
|
return self.async_abort(reason="reauth_unsuccessful")
|
||||||
|
|
||||||
update_client_key(self.hass, self._entry, client)
|
reauth_entry = self._get_reauth_entry()
|
||||||
await self.hass.config_entries.async_reload(self._entry.entry_id)
|
update_client_key(self.hass, reauth_entry, client)
|
||||||
|
await self.hass.config_entries.async_reload(reauth_entry.entry_id)
|
||||||
return self.async_abort(reason="reauth_successful")
|
return self.async_abort(reason="reauth_successful")
|
||||||
|
|
||||||
return self.async_show_form(step_id="reauth_confirm")
|
return self.async_show_form(step_id="reauth_confirm")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user