mirror of
https://github.com/home-assistant/core.git
synced 2025-04-25 17:57:55 +00:00
Use standard argument name in async_step_reauth (#74139)
This commit is contained in:
parent
48c7e414f6
commit
ef5fccad9e
@ -150,9 +150,9 @@ class AbodeFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
|
||||
return await self._async_abode_mfa_login()
|
||||
|
||||
async def async_step_reauth(self, config: Mapping[str, Any]) -> FlowResult:
|
||||
async def async_step_reauth(self, entry_data: Mapping[str, Any]) -> FlowResult:
|
||||
"""Handle reauthorization request from Abode."""
|
||||
self._username = config[CONF_USERNAME]
|
||||
self._username = entry_data[CONF_USERNAME]
|
||||
|
||||
return await self.async_step_reauth_confirm()
|
||||
|
||||
|
@ -221,10 +221,10 @@ class AirVisualFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
data={**user_input, CONF_INTEGRATION_TYPE: INTEGRATION_TYPE_NODE_PRO},
|
||||
)
|
||||
|
||||
async def async_step_reauth(self, data: Mapping[str, Any]) -> FlowResult:
|
||||
async def async_step_reauth(self, entry_data: Mapping[str, Any]) -> FlowResult:
|
||||
"""Handle configuration by re-auth."""
|
||||
self._entry_data_for_reauth = data
|
||||
self._geo_id = async_get_geography_id(data)
|
||||
self._entry_data_for_reauth = entry_data
|
||||
self._geo_id = async_get_geography_id(entry_data)
|
||||
return await self.async_step_reauth_confirm()
|
||||
|
||||
async def async_step_reauth_confirm(
|
||||
|
@ -77,9 +77,9 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
errors=errors,
|
||||
)
|
||||
|
||||
async def async_step_reauth(self, data: Mapping[str, Any]) -> FlowResult:
|
||||
async def async_step_reauth(self, entry_data: Mapping[str, Any]) -> FlowResult:
|
||||
"""Handle reauth on credential failure."""
|
||||
self._reauth_username = data[CONF_USERNAME]
|
||||
self._reauth_username = entry_data[CONF_USERNAME]
|
||||
|
||||
return await self.async_step_reauth_confirm()
|
||||
|
||||
|
@ -139,18 +139,18 @@ class AxisFlowHandler(config_entries.ConfigFlow, domain=AXIS_DOMAIN):
|
||||
title = f"{model} - {serial}"
|
||||
return self.async_create_entry(title=title, data=self.device_config)
|
||||
|
||||
async def async_step_reauth(self, device_config: Mapping[str, Any]) -> FlowResult:
|
||||
async def async_step_reauth(self, entry_data: Mapping[str, Any]) -> FlowResult:
|
||||
"""Trigger a reauthentication flow."""
|
||||
self.context["title_placeholders"] = {
|
||||
CONF_NAME: device_config[CONF_NAME],
|
||||
CONF_HOST: device_config[CONF_HOST],
|
||||
CONF_NAME: entry_data[CONF_NAME],
|
||||
CONF_HOST: entry_data[CONF_HOST],
|
||||
}
|
||||
|
||||
self.discovery_schema = {
|
||||
vol.Required(CONF_HOST, default=device_config[CONF_HOST]): str,
|
||||
vol.Required(CONF_USERNAME, default=device_config[CONF_USERNAME]): str,
|
||||
vol.Required(CONF_HOST, default=entry_data[CONF_HOST]): str,
|
||||
vol.Required(CONF_USERNAME, default=entry_data[CONF_USERNAME]): str,
|
||||
vol.Required(CONF_PASSWORD): str,
|
||||
vol.Required(CONF_PORT, default=device_config[CONF_PORT]): int,
|
||||
vol.Required(CONF_PORT, default=entry_data[CONF_PORT]): int,
|
||||
}
|
||||
|
||||
return await self.async_step_user()
|
||||
|
@ -205,12 +205,12 @@ class DeconzFlowHandler(ConfigFlow, domain=DOMAIN):
|
||||
},
|
||||
)
|
||||
|
||||
async def async_step_reauth(self, config: Mapping[str, Any]) -> FlowResult:
|
||||
async def async_step_reauth(self, entry_data: Mapping[str, Any]) -> FlowResult:
|
||||
"""Trigger a reauthentication flow."""
|
||||
self.context["title_placeholders"] = {CONF_HOST: config[CONF_HOST]}
|
||||
self.context["title_placeholders"] = {CONF_HOST: entry_data[CONF_HOST]}
|
||||
|
||||
self.host = config[CONF_HOST]
|
||||
self.port = config[CONF_PORT]
|
||||
self.host = entry_data[CONF_HOST]
|
||||
self.port = entry_data[CONF_PORT]
|
||||
|
||||
return await self.async_step_link()
|
||||
|
||||
|
@ -68,14 +68,14 @@ class DevoloHomeControlFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
step_id="zeroconf_confirm", errors={"base": "invalid_auth"}
|
||||
)
|
||||
|
||||
async def async_step_reauth(self, data: Mapping[str, Any]) -> FlowResult:
|
||||
async def async_step_reauth(self, entry_data: Mapping[str, Any]) -> FlowResult:
|
||||
"""Handle reauthentication."""
|
||||
self._reauth_entry = self.hass.config_entries.async_get_entry(
|
||||
self.context["entry_id"]
|
||||
)
|
||||
self._url = data[CONF_MYDEVOLO]
|
||||
self._url = entry_data[CONF_MYDEVOLO]
|
||||
self.data_schema = {
|
||||
vol.Required(CONF_USERNAME, default=data[CONF_USERNAME]): str,
|
||||
vol.Required(CONF_USERNAME, default=entry_data[CONF_USERNAME]): str,
|
||||
vol.Required(CONF_PASSWORD): str,
|
||||
}
|
||||
return await self.async_step_reauth_confirm()
|
||||
|
@ -231,13 +231,13 @@ class FritzBoxToolsFlowHandler(ConfigFlow, domain=DOMAIN):
|
||||
|
||||
return self._async_create_entry()
|
||||
|
||||
async def async_step_reauth(self, data: Mapping[str, Any]) -> FlowResult:
|
||||
async def async_step_reauth(self, entry_data: Mapping[str, Any]) -> FlowResult:
|
||||
"""Handle flow upon an API authentication error."""
|
||||
self._entry = self.hass.config_entries.async_get_entry(self.context["entry_id"])
|
||||
self._host = data[CONF_HOST]
|
||||
self._port = data[CONF_PORT]
|
||||
self._username = data[CONF_USERNAME]
|
||||
self._password = data[CONF_PASSWORD]
|
||||
self._host = entry_data[CONF_HOST]
|
||||
self._port = entry_data[CONF_PORT]
|
||||
self._username = entry_data[CONF_USERNAME]
|
||||
self._password = entry_data[CONF_PASSWORD]
|
||||
return await self.async_step_reauth_confirm()
|
||||
|
||||
def _show_setup_form_reauth_confirm(
|
||||
|
@ -176,14 +176,14 @@ class FritzboxConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
errors=errors,
|
||||
)
|
||||
|
||||
async def async_step_reauth(self, data: Mapping[str, Any]) -> FlowResult:
|
||||
async def async_step_reauth(self, entry_data: Mapping[str, Any]) -> FlowResult:
|
||||
"""Trigger a reauthentication flow."""
|
||||
entry = self.hass.config_entries.async_get_entry(self.context["entry_id"])
|
||||
assert entry is not None
|
||||
self._entry = entry
|
||||
self._host = data[CONF_HOST]
|
||||
self._name = str(data[CONF_HOST])
|
||||
self._username = data[CONF_USERNAME]
|
||||
self._host = entry_data[CONF_HOST]
|
||||
self._name = str(entry_data[CONF_HOST])
|
||||
self._username = entry_data[CONF_USERNAME]
|
||||
|
||||
return await self.async_step_reauth_confirm()
|
||||
|
||||
|
@ -45,10 +45,10 @@ class MeaterConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
|
||||
return await self._try_connect_meater("user", None, username, password)
|
||||
|
||||
async def async_step_reauth(self, data: Mapping[str, Any]) -> FlowResult:
|
||||
async def async_step_reauth(self, entry_data: Mapping[str, Any]) -> FlowResult:
|
||||
"""Handle configuration by re-auth."""
|
||||
self._data_schema = REAUTH_SCHEMA
|
||||
self._username = data[CONF_USERNAME]
|
||||
self._username = entry_data[CONF_USERNAME]
|
||||
return await self.async_step_reauth_confirm()
|
||||
|
||||
async def async_step_reauth_confirm(
|
||||
|
@ -190,11 +190,11 @@ class NAMFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
errors=errors,
|
||||
)
|
||||
|
||||
async def async_step_reauth(self, data: Mapping[str, Any]) -> FlowResult:
|
||||
async def async_step_reauth(self, entry_data: Mapping[str, Any]) -> FlowResult:
|
||||
"""Handle configuration by re-auth."""
|
||||
if entry := self.hass.config_entries.async_get_entry(self.context["entry_id"]):
|
||||
self.entry = entry
|
||||
self.host = data[CONF_HOST]
|
||||
self.host = entry_data[CONF_HOST]
|
||||
self.context["title_placeholders"] = {"host": self.host}
|
||||
return await self.async_step_reauth_confirm()
|
||||
|
||||
|
@ -78,13 +78,15 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
)
|
||||
return await self.async_step_link()
|
||||
|
||||
async def async_step_reauth(self, data: Mapping[str, Any]) -> FlowResult:
|
||||
async def async_step_reauth(self, entry_data: Mapping[str, Any]) -> FlowResult:
|
||||
"""Handle Nanoleaf reauth flow if token is invalid."""
|
||||
self.reauth_entry = cast(
|
||||
config_entries.ConfigEntry,
|
||||
self.hass.config_entries.async_get_entry(self.context["entry_id"]),
|
||||
)
|
||||
self.nanoleaf = Nanoleaf(async_get_clientsession(self.hass), data[CONF_HOST])
|
||||
self.nanoleaf = Nanoleaf(
|
||||
async_get_clientsession(self.hass), entry_data[CONF_HOST]
|
||||
)
|
||||
self.context["title_placeholders"] = {"name": self.reauth_entry.title}
|
||||
return await self.async_step_link()
|
||||
|
||||
|
@ -218,10 +218,10 @@ class NestFlowHandler(
|
||||
return await self.async_step_finish()
|
||||
return await self.async_step_pubsub()
|
||||
|
||||
async def async_step_reauth(self, user_input: Mapping[str, Any]) -> FlowResult:
|
||||
async def async_step_reauth(self, entry_data: Mapping[str, Any]) -> FlowResult:
|
||||
"""Perform reauth upon an API authentication error."""
|
||||
assert self.config_mode != ConfigMode.LEGACY, "Step only supported for SDM API"
|
||||
self._data.update(user_input)
|
||||
self._data.update(entry_data)
|
||||
|
||||
return await self.async_step_reauth_confirm()
|
||||
|
||||
|
@ -74,9 +74,9 @@ class NotionFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
|
||||
return self.async_create_entry(title=self._username, data=data)
|
||||
|
||||
async def async_step_reauth(self, config: Mapping[str, Any]) -> FlowResult:
|
||||
async def async_step_reauth(self, entry_data: Mapping[str, Any]) -> FlowResult:
|
||||
"""Handle configuration by re-auth."""
|
||||
self._username = config[CONF_USERNAME]
|
||||
self._username = entry_data[CONF_USERNAME]
|
||||
return await self.async_step_reauth_confirm()
|
||||
|
||||
async def async_step_reauth_confirm(
|
||||
|
@ -155,7 +155,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
|
||||
return await self.async_step_user()
|
||||
|
||||
async def async_step_reauth(self, data: Mapping[str, Any]) -> FlowResult:
|
||||
async def async_step_reauth(self, entry_data: Mapping[str, Any]) -> FlowResult:
|
||||
"""Handle reauth."""
|
||||
self._config_entry = cast(
|
||||
ConfigEntry,
|
||||
@ -169,4 +169,4 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
self._default_user = self._config_entry.data[CONF_USERNAME]
|
||||
self._default_hub = self._config_entry.data[CONF_HUB]
|
||||
|
||||
return await self.async_step_user(dict(data))
|
||||
return await self.async_step_user(dict(entry_data))
|
||||
|
@ -93,9 +93,9 @@ class RenaultFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
),
|
||||
)
|
||||
|
||||
async def async_step_reauth(self, data: Mapping[str, Any]) -> FlowResult:
|
||||
async def async_step_reauth(self, entry_data: Mapping[str, Any]) -> FlowResult:
|
||||
"""Perform reauth upon an API authentication error."""
|
||||
self._original_data = data
|
||||
self._original_data = entry_data
|
||||
return await self.async_step_reauth_confirm()
|
||||
|
||||
async def async_step_reauth_confirm(
|
||||
|
@ -81,9 +81,9 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
data={CONF_USERNAME: self._username, CONF_PASSWORD: self._password},
|
||||
)
|
||||
|
||||
async def async_step_reauth(self, config: Mapping[str, Any]) -> FlowResult:
|
||||
async def async_step_reauth(self, entry_data: Mapping[str, Any]) -> FlowResult:
|
||||
"""Handle configuration by re-auth."""
|
||||
self._username = config[CONF_USERNAME]
|
||||
self._username = entry_data[CONF_USERNAME]
|
||||
return await self.async_step_reauth_confirm()
|
||||
|
||||
async def async_step_reauth_confirm(
|
||||
|
@ -98,16 +98,16 @@ class SimpliSafeFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
"""Define the config flow to handle options."""
|
||||
return SimpliSafeOptionsFlowHandler(config_entry)
|
||||
|
||||
async def async_step_reauth(self, config: Mapping[str, Any]) -> FlowResult:
|
||||
async def async_step_reauth(self, entry_data: Mapping[str, Any]) -> FlowResult:
|
||||
"""Handle configuration by re-auth."""
|
||||
self._reauth = True
|
||||
|
||||
if CONF_USERNAME not in config:
|
||||
if CONF_USERNAME not in entry_data:
|
||||
# Old versions of the config flow may not have the username by this point;
|
||||
# in that case, we reauth them by making them go through the user flow:
|
||||
return await self.async_step_user()
|
||||
|
||||
self._username = config[CONF_USERNAME]
|
||||
self._username = entry_data[CONF_USERNAME]
|
||||
return await self.async_step_reauth_confirm()
|
||||
|
||||
async def _async_get_email_2fa(self) -> None:
|
||||
|
@ -80,12 +80,12 @@ class SleepIQFlowHandler(ConfigFlow, domain=DOMAIN):
|
||||
last_step=True,
|
||||
)
|
||||
|
||||
async def async_step_reauth(self, data: Mapping[str, Any]) -> FlowResult:
|
||||
async def async_step_reauth(self, entry_data: Mapping[str, Any]) -> FlowResult:
|
||||
"""Perform reauth upon an API authentication error."""
|
||||
self._reauth_entry = self.hass.config_entries.async_get_entry(
|
||||
self.context["entry_id"]
|
||||
)
|
||||
return await self.async_step_reauth_confirm(dict(data))
|
||||
return await self.async_step_reauth_confirm(dict(entry_data))
|
||||
|
||||
async def async_step_reauth_confirm(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
|
@ -87,9 +87,9 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
step_id="user", data_schema=USER_DATA_SCHEMA, errors=errors
|
||||
)
|
||||
|
||||
async def async_step_reauth(self, config: Mapping[str, Any]) -> FlowResult:
|
||||
async def async_step_reauth(self, entry_data: Mapping[str, Any]) -> FlowResult:
|
||||
"""Handle configuration by re-auth."""
|
||||
self._username = config[CONF_USERNAME]
|
||||
self._username = entry_data[CONF_USERNAME]
|
||||
return await self.async_step_reauth_confirm()
|
||||
|
||||
async def async_step_reauth_confirm(
|
||||
|
@ -300,9 +300,9 @@ class SynologyDSMFlowHandler(ConfigFlow, domain=DOMAIN):
|
||||
user_input = {**self.discovered_conf, **user_input}
|
||||
return await self.async_validate_input_create_entry(user_input, step_id=step)
|
||||
|
||||
async def async_step_reauth(self, data: Mapping[str, Any]) -> FlowResult:
|
||||
async def async_step_reauth(self, entry_data: Mapping[str, Any]) -> FlowResult:
|
||||
"""Perform reauth upon an API authentication error."""
|
||||
self.reauth_conf = data
|
||||
self.reauth_conf = entry_data
|
||||
return await self.async_step_reauth_confirm()
|
||||
|
||||
async def async_step_reauth_confirm(
|
||||
|
@ -75,9 +75,9 @@ class TileFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
"""Import a config entry from configuration.yaml."""
|
||||
return await self.async_step_user(import_config)
|
||||
|
||||
async def async_step_reauth(self, config: Mapping[str, Any]) -> FlowResult:
|
||||
async def async_step_reauth(self, entry_data: Mapping[str, Any]) -> FlowResult:
|
||||
"""Handle configuration by re-auth."""
|
||||
self._username = config[CONF_USERNAME]
|
||||
self._username = entry_data[CONF_USERNAME]
|
||||
return await self.async_step_reauth_confirm()
|
||||
|
||||
async def async_step_reauth_confirm(
|
||||
|
@ -190,9 +190,9 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
)
|
||||
return await self.async_step_coordinates()
|
||||
|
||||
async def async_step_reauth(self, config: Mapping[str, Any]) -> FlowResult:
|
||||
async def async_step_reauth(self, entry_data: Mapping[str, Any]) -> FlowResult:
|
||||
"""Handle configuration by re-auth."""
|
||||
self._data = {**config}
|
||||
self._data = {**entry_data}
|
||||
return await self.async_step_reauth_confirm()
|
||||
|
||||
async def async_step_reauth_confirm(
|
||||
|
@ -129,12 +129,12 @@ class XiaomiMiioFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
"""Get the options flow."""
|
||||
return OptionsFlowHandler(config_entry)
|
||||
|
||||
async def async_step_reauth(self, user_input: Mapping[str, Any]) -> FlowResult:
|
||||
async def async_step_reauth(self, entry_data: Mapping[str, Any]) -> FlowResult:
|
||||
"""Perform reauth upon an authentication error or missing cloud credentials."""
|
||||
self.host = user_input[CONF_HOST]
|
||||
self.token = user_input[CONF_TOKEN]
|
||||
self.mac = user_input[CONF_MAC]
|
||||
self.model = user_input.get(CONF_MODEL)
|
||||
self.host = entry_data[CONF_HOST]
|
||||
self.token = entry_data[CONF_TOKEN]
|
||||
self.mac = entry_data[CONF_MAC]
|
||||
self.model = entry_data.get(CONF_MODEL)
|
||||
return await self.async_step_reauth_confirm()
|
||||
|
||||
async def async_step_reauth_confirm(
|
||||
|
Loading…
x
Reference in New Issue
Block a user