Change auth warning (#16216)

pull/16218/head
Paulus Schoutsen 2018-08-27 10:37:03 +02:00 committed by Fabian Affolter
parent 94662620e2
commit 9d491f5322
2 changed files with 5 additions and 13 deletions

View File

@ -200,18 +200,10 @@ class HomeAssistantHTTP:
if is_ban_enabled: if is_ban_enabled:
setup_bans(hass, app, login_threshold) setup_bans(hass, app, login_threshold)
if hass.auth.active: if hass.auth.active and hass.auth.support_legacy:
if hass.auth.support_legacy: _LOGGER.warning(
_LOGGER.warning("Experimental auth api enabled and " "legacy_api_password support has been enabled. If you don't"
"legacy_api_password support enabled. Please " "require it, remove the 'api_password' from your http config.")
"use access_token instead api_password, "
"although you can still use legacy "
"api_password")
else:
_LOGGER.warning("Experimental auth api enabled. Please use "
"access_token instead api_password.")
elif api_password is None:
_LOGGER.warning("You have been advised to set http.api_password.")
setup_auth(app, trusted_networks, hass.auth.active, setup_auth(app, trusted_networks, hass.auth.active,
support_legacy=hass.auth.support_legacy, support_legacy=hass.auth.support_legacy,

View File

@ -32,7 +32,7 @@ def setup_auth(app, trusted_networks, use_auth,
if request.path not in old_auth_warning: if request.path not in old_auth_warning:
_LOGGER.log( _LOGGER.log(
logging.INFO if support_legacy else logging.WARNING, logging.INFO if support_legacy else logging.WARNING,
'Please change to use bearer token access %s from %s', 'You need to use a bearer token to access %s from %s',
request.path, request[KEY_REAL_IP]) request.path, request[KEY_REAL_IP])
old_auth_warning.add(request.path) old_auth_warning.add(request.path)