From e2eb986c7c924298120d0c79ef901d57b87f7d09 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Wed, 2 Oct 2024 16:13:02 +0200 Subject: [PATCH] Adjust reauth checks in august (#127320) --- homeassistant/components/august/config_flow.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/august/config_flow.py b/homeassistant/components/august/config_flow.py index 58c3549fe4d..640b04b384f 100644 --- a/homeassistant/components/august/config_flow.py +++ b/homeassistant/components/august/config_flow.py @@ -12,7 +12,7 @@ from yalexs.authenticator_common import ValidationResult from yalexs.const import BRANDS_WITHOUT_OAUTH, DEFAULT_BRAND, Brand from yalexs.manager.exceptions import CannotConnect, InvalidAuth, RequireValidation -from homeassistant.config_entries import ConfigFlow, ConfigFlowResult +from homeassistant.config_entries import SOURCE_REAUTH, ConfigFlow, ConfigFlowResult from homeassistant.const import CONF_PASSWORD, CONF_USERNAME from homeassistant.core import callback @@ -93,7 +93,6 @@ class AugustConfigFlow(ConfigFlow, domain=DOMAIN): self._aiohttp_session: aiohttp.ClientSession | None = None self._user_auth_details: dict[str, Any] = {} self._needs_reset = True - self._mode: str | None = None super().__init__() async def async_step_user( @@ -147,7 +146,7 @@ class AugustConfigFlow(ConfigFlow, domain=DOMAIN): ) -> ConfigFlowResult: """Handle validation (2fa) step.""" if user_input: - if self._mode == "reauth": + if self.source == SOURCE_REAUTH: return await self.async_step_reauth_validate(user_input) return await self.async_step_user_validate(user_input) @@ -188,8 +187,6 @@ class AugustConfigFlow(ConfigFlow, domain=DOMAIN): ) -> ConfigFlowResult: """Handle configuration by re-auth.""" self._user_auth_details = dict(entry_data) - self._mode = "reauth" - self._needs_reset = True return await self.async_step_reauth_validate() async def async_step_reauth_validate(