Reset failed login attempts counter when login success (#15564)

This commit is contained in:
Jason Hu authored and Paulus Schoutsen committed 2018-07-20 12:09:48 +02:00
1 parent f2a99e83cd
commit f1286f8e6b
4 files changed
+91 -6

No files matched your search

+6 -2
View File
@@ -12,6 +12,7 @@ from aiohttp import web
from aiohttp.web_exceptions import HTTPUnauthorized, HTTPInternalServerError
import homeassistant.remote as rem
from homeassistant.components.http.ban import process_success_login
from homeassistant.core import is_callback
from homeassistant.const import CONTENT_TYPE_JSON
@@ -91,8 +92,11 @@ def request_handler_factory(view, handler):
authenticated = request.get(KEY_AUTHENTICATED, False)
if view.requires_auth and not authenticated:
raise HTTPUnauthorized()
if view.requires_auth:
if authenticated:
await process_success_login(request)
else:
raise HTTPUnauthorized()
_LOGGER.info('Serving %s to %s (auth: %s)',
request.path, request.get(KEY_REAL_IP), authenticated)