mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-10 18:56:30 +00:00
Don't clean cache on fake auth (#765)
* Don't clean cache on fake auth * Update auth.py
This commit is contained in:
parent
cee2c5469f
commit
84f791220e
@ -43,9 +43,13 @@ class Auth(JsonConfig, CoreSysAttributes):
|
|||||||
self._data[username_h] = password_h
|
self._data[username_h] = password_h
|
||||||
self.save_data()
|
self.save_data()
|
||||||
|
|
||||||
def _dismatch_cache(self, username):
|
def _dismatch_cache(self, username, password):
|
||||||
"""Remove user from cache."""
|
"""Remove user from cache."""
|
||||||
username_h = _rehash(username)
|
username_h = _rehash(username)
|
||||||
|
password_h = _rehash(password, username)
|
||||||
|
|
||||||
|
if self._data.get(username_h) =! password_h:
|
||||||
|
return
|
||||||
|
|
||||||
self._data.pop(username_h, None)
|
self._data.pop(username_h, None)
|
||||||
self.save_data()
|
self.save_data()
|
||||||
@ -76,7 +80,7 @@ class Auth(JsonConfig, CoreSysAttributes):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
_LOGGER.warning("Wrong login from %s", username)
|
_LOGGER.warning("Wrong login from %s", username)
|
||||||
self._dismatch_cache(username)
|
self._dismatch_cache(username, password)
|
||||||
return False
|
return False
|
||||||
except HomeAssistantAPIError:
|
except HomeAssistantAPIError:
|
||||||
_LOGGER.error("Can't request auth on Home Assistant!")
|
_LOGGER.error("Can't request auth on Home Assistant!")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user