mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 14:17:45 +00:00
Improve type hints in Time-based One Time Password auth module (#130420)
This commit is contained in:
parent
600f83ddab
commit
b6d981fe9e
@ -177,17 +177,17 @@ class TotpAuthModule(MultiFactorAuthModule):
|
|||||||
class TotpSetupFlow(SetupFlow):
|
class TotpSetupFlow(SetupFlow):
|
||||||
"""Handler for the setup flow."""
|
"""Handler for the setup flow."""
|
||||||
|
|
||||||
|
_auth_module: TotpAuthModule
|
||||||
|
_ota_secret: str
|
||||||
|
_url: str
|
||||||
|
_image: str
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, auth_module: TotpAuthModule, setup_schema: vol.Schema, user: User
|
self, auth_module: TotpAuthModule, setup_schema: vol.Schema, user: User
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Initialize the setup flow."""
|
"""Initialize the setup flow."""
|
||||||
super().__init__(auth_module, setup_schema, user.id)
|
super().__init__(auth_module, setup_schema, user.id)
|
||||||
# to fix typing complaint
|
|
||||||
self._auth_module: TotpAuthModule = auth_module
|
|
||||||
self._user = user
|
self._user = user
|
||||||
self._ota_secret: str = ""
|
|
||||||
self._url: str | None = None
|
|
||||||
self._image: str | None = None
|
|
||||||
|
|
||||||
async def async_step_init(
|
async def async_step_init(
|
||||||
self, user_input: dict[str, str] | None = None
|
self, user_input: dict[str, str] | None = None
|
||||||
@ -214,12 +214,11 @@ class TotpSetupFlow(SetupFlow):
|
|||||||
errors["base"] = "invalid_code"
|
errors["base"] = "invalid_code"
|
||||||
|
|
||||||
else:
|
else:
|
||||||
hass = self._auth_module.hass
|
|
||||||
(
|
(
|
||||||
self._ota_secret,
|
self._ota_secret,
|
||||||
self._url,
|
self._url,
|
||||||
self._image,
|
self._image,
|
||||||
) = await hass.async_add_executor_job(
|
) = await self._auth_module.hass.async_add_executor_job(
|
||||||
_generate_secret_and_qr_code,
|
_generate_secret_and_qr_code,
|
||||||
str(self._user.name),
|
str(self._user.name),
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user