mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Use reauth helpers in aosmith config flow (#127432)
Use async_update_reload_and_abort in aosmith config flow
This commit is contained in:
parent
4aedf662e9
commit
9ba58233ec
@ -87,20 +87,15 @@ class AOSmithConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
errors: dict[str, str] = {}
|
errors: dict[str, str] = {}
|
||||||
if user_input:
|
if user_input:
|
||||||
password = user_input[CONF_PASSWORD]
|
password = user_input[CONF_PASSWORD]
|
||||||
entry_id = self.context["entry_id"]
|
|
||||||
|
|
||||||
if entry := self.hass.config_entries.async_get_entry(entry_id):
|
entry = self._get_reauth_entry()
|
||||||
error = await self._async_validate_credentials(
|
error = await self._async_validate_credentials(self._reauth_email, password)
|
||||||
self._reauth_email, password
|
if error is None:
|
||||||
|
return self.async_update_reload_and_abort(
|
||||||
|
entry,
|
||||||
|
data=entry.data | user_input,
|
||||||
)
|
)
|
||||||
if error is None:
|
errors["base"] = error
|
||||||
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")
|
|
||||||
errors["base"] = error
|
|
||||||
|
|
||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
step_id="reauth_confirm",
|
step_id="reauth_confirm",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user