mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Use new reauth_helpers in onvif (#128705)
This commit is contained in:
parent
5816342bed
commit
157e7f9f78
@ -102,7 +102,6 @@ class OnvifFlowHandler(ConfigFlow, domain=DOMAIN):
|
||||
"""Handle a ONVIF config flow."""
|
||||
|
||||
VERSION = 1
|
||||
_reauth_entry: ConfigEntry
|
||||
|
||||
@staticmethod
|
||||
@callback
|
||||
@ -136,30 +135,28 @@ class OnvifFlowHandler(ConfigFlow, domain=DOMAIN):
|
||||
self, entry_data: Mapping[str, Any]
|
||||
) -> ConfigFlowResult:
|
||||
"""Handle re-authentication of an existing config entry."""
|
||||
reauth_entry = self.hass.config_entries.async_get_entry(
|
||||
self.context["entry_id"]
|
||||
)
|
||||
assert reauth_entry is not None
|
||||
self._reauth_entry = reauth_entry
|
||||
return await self.async_step_reauth_confirm()
|
||||
|
||||
async def async_step_reauth_confirm(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
"""Confirm reauth."""
|
||||
entry = self._reauth_entry
|
||||
errors: dict[str, str] | None = {}
|
||||
reauth_entry = self._get_reauth_entry()
|
||||
description_placeholders: dict[str, str] | None = None
|
||||
if user_input is not None:
|
||||
entry_data = entry.data
|
||||
self.onvif_config = entry_data | user_input
|
||||
self.onvif_config = reauth_entry.data | user_input
|
||||
errors, description_placeholders = await self.async_setup_profiles(
|
||||
configure_unique_id=False
|
||||
)
|
||||
if not errors:
|
||||
return self.async_update_reload_and_abort(entry, data=self.onvif_config)
|
||||
return self.async_update_reload_and_abort(
|
||||
reauth_entry, data=self.onvif_config
|
||||
)
|
||||
|
||||
username = (user_input or {}).get(CONF_USERNAME) or entry.data[CONF_USERNAME]
|
||||
username = (user_input or {}).get(CONF_USERNAME) or reauth_entry.data[
|
||||
CONF_USERNAME
|
||||
]
|
||||
return self.async_show_form(
|
||||
step_id="reauth_confirm",
|
||||
data_schema=vol.Schema(
|
||||
|
Loading…
x
Reference in New Issue
Block a user