mirror of
https://github.com/home-assistant/core.git
synced 2025-10-15 14:49:34 +00:00
Merge of nested IF-IF cases - Core (#48364)
This commit is contained in:
@@ -77,17 +77,11 @@ class InsecureExampleModule(MultiFactorAuthModule):
|
||||
|
||||
async def async_is_user_setup(self, user_id: str) -> bool:
|
||||
"""Return whether user is setup."""
|
||||
for data in self._data:
|
||||
if data["user_id"] == user_id:
|
||||
return True
|
||||
return False
|
||||
return any(data["user_id"] == user_id for data in self._data)
|
||||
|
||||
async def async_validate(self, user_id: str, user_input: dict[str, Any]) -> bool:
|
||||
"""Return True if validation passed."""
|
||||
for data in self._data:
|
||||
if data["user_id"] == user_id:
|
||||
# user_input has been validate in caller
|
||||
if data["pin"] == user_input["pin"]:
|
||||
return True
|
||||
|
||||
return False
|
||||
return any(
|
||||
data["user_id"] == user_id and data["pin"] == user_input["pin"]
|
||||
for data in self._data
|
||||
)
|
||||
|
Reference in New Issue
Block a user