Use new reauth helpers in skybell (#128741)

pull/128808/head
epenet 2024-10-19 14:44:06 +02:00 committed by GitHub
parent 8a16504988
commit 10b04f41df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 10 deletions

View File

@ -34,16 +34,11 @@ class SkybellFlowHandler(ConfigFlow, domain=DOMAIN):
errors = {}
if user_input:
password = user_input[CONF_PASSWORD]
entry_id = self.context["entry_id"]
if entry := self.hass.config_entries.async_get_entry(entry_id):
_, error = await self._async_validate_input(self.reauth_email, password)
if error is None:
self.hass.config_entries.async_update_entry(
entry,
data=entry.data | user_input,
)
await self.hass.config_entries.async_reload(entry.entry_id)
return self.async_abort(reason="reauth_successful")
_, error = await self._async_validate_input(self.reauth_email, password)
if error is None:
return self.async_update_reload_and_abort(
self._get_reauth_entry(), data_updates=user_input
)
errors["base"] = error
return self.async_show_form(