Use new reauth helpers in steam_online (#128746)

This commit is contained in:
epenet 2024-10-19 14:56:47 +02:00 committed by GitHub
parent 93ec127245
commit b35c1d852e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -36,10 +36,6 @@ def validate_input(user_input: dict[str, str]) -> dict[str, str | int]:
class SteamFlowHandler(ConfigFlow, domain=DOMAIN): class SteamFlowHandler(ConfigFlow, domain=DOMAIN):
"""Handle a config flow for Steam.""" """Handle a config flow for Steam."""
def __init__(self) -> None:
"""Initialize the flow."""
self.entry: SteamConfigEntry | None = None
@staticmethod @staticmethod
@callback @callback
def async_get_options_flow( def async_get_options_flow(
@ -53,8 +49,8 @@ class SteamFlowHandler(ConfigFlow, domain=DOMAIN):
) -> ConfigFlowResult: ) -> ConfigFlowResult:
"""Handle a flow initiated by the user.""" """Handle a flow initiated by the user."""
errors = {} errors = {}
if user_input is None and self.entry: if user_input is None and self.source == SOURCE_REAUTH:
user_input = {CONF_ACCOUNT: self.entry.data[CONF_ACCOUNT]} user_input = {CONF_ACCOUNT: self._get_reauth_entry().data[CONF_ACCOUNT]}
elif user_input is not None: elif user_input is not None:
try: try:
res = await self.hass.async_add_executor_job(validate_input, user_input) res = await self.hass.async_add_executor_job(validate_input, user_input)
@ -102,8 +98,6 @@ class SteamFlowHandler(ConfigFlow, domain=DOMAIN):
self, entry_data: Mapping[str, Any] self, entry_data: Mapping[str, Any]
) -> ConfigFlowResult: ) -> ConfigFlowResult:
"""Handle a reauthorization flow request.""" """Handle a reauthorization flow request."""
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(