mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 10:17:09 +00:00
Fix HTTP login attempts check triggering too late (#20431)
This commit is contained in:
parent
76c0295403
commit
d39784906b
@ -104,7 +104,7 @@ async def process_wrong_login(request):
|
|||||||
|
|
||||||
request.app[KEY_FAILED_LOGIN_ATTEMPTS][remote_addr] += 1
|
request.app[KEY_FAILED_LOGIN_ATTEMPTS][remote_addr] += 1
|
||||||
|
|
||||||
if (request.app[KEY_FAILED_LOGIN_ATTEMPTS][remote_addr] >
|
if (request.app[KEY_FAILED_LOGIN_ATTEMPTS][remote_addr] >=
|
||||||
request.app[KEY_LOGIN_THRESHOLD]):
|
request.app[KEY_LOGIN_THRESHOLD]):
|
||||||
new_ban = IpBan(remote_addr)
|
new_ban = IpBan(remote_addr)
|
||||||
request.app[KEY_BANNED_IPS].append(new_ban)
|
request.app[KEY_BANNED_IPS].append(new_ban)
|
||||||
|
@ -71,7 +71,7 @@ async def test_ip_bans_file_creation(hass, aiohttp_client):
|
|||||||
raise HTTPUnauthorized
|
raise HTTPUnauthorized
|
||||||
|
|
||||||
app.router.add_get('/', unauth_handler)
|
app.router.add_get('/', unauth_handler)
|
||||||
setup_bans(hass, app, 1)
|
setup_bans(hass, app, 2)
|
||||||
mock_real_ip(app)("200.201.202.204")
|
mock_real_ip(app)("200.201.202.204")
|
||||||
|
|
||||||
with patch('homeassistant.components.http.ban.async_load_ip_bans_config',
|
with patch('homeassistant.components.http.ban.async_load_ip_bans_config',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user