1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Tweak MFA login flow (#16254)

* Tweak MFA login flow

* Fix typo
This commit is contained in:
Jason Hu
2018-08-29 01:16:54 -07:00
committed by Paulus Schoutsen
parent 63614a477a
commit 563588651c
5 changed files with 23 additions and 23 deletions

View File

@@ -137,8 +137,9 @@ class TotpAuthModule(MultiFactorAuthModule):
await self._async_load()
# user_input has been validate in caller
# set INPUT_FIELD_CODE as vol.Required is not user friendly
return await self.hass.async_add_executor_job(
self._validate_2fa, user_id, user_input[INPUT_FIELD_CODE])
self._validate_2fa, user_id, user_input.get(INPUT_FIELD_CODE, ''))
def _validate_2fa(self, user_id: str, code: str) -> bool:
"""Validate two factor authentication code."""