mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 17:57:11 +00:00
Fix onboarding (#64557)
* Adjust auth and hassio import * Adjust pylint Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
549afff307
commit
e59510f0ce
@ -8,7 +8,7 @@ from aiohttp.web_exceptions import HTTPUnauthorized
|
|||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.auth.const import GROUP_ID_ADMIN
|
from homeassistant.auth.const import GROUP_ID_ADMIN
|
||||||
from homeassistant.components import auth, hassio, person
|
from homeassistant.components import person
|
||||||
from homeassistant.components.auth import indieauth
|
from homeassistant.components.auth import indieauth
|
||||||
from homeassistant.components.http.const import KEY_HASS_REFRESH_TOKEN_ID
|
from homeassistant.components.http.const import KEY_HASS_REFRESH_TOKEN_ID
|
||||||
from homeassistant.components.http.data_validator import RequestDataValidator
|
from homeassistant.components.http.data_validator import RequestDataValidator
|
||||||
@ -162,7 +162,10 @@ class UserOnboardingView(_BaseOnboardingView):
|
|||||||
|
|
||||||
# Return authorization code for fetching tokens and connect
|
# Return authorization code for fetching tokens and connect
|
||||||
# during onboarding.
|
# during onboarding.
|
||||||
auth_code = auth.create_auth_code(hass, data["client_id"], credentials)
|
# pylint: disable=import-outside-toplevel
|
||||||
|
from homeassistant.components.auth import create_auth_code
|
||||||
|
|
||||||
|
auth_code = create_auth_code(hass, data["client_id"], credentials)
|
||||||
return self.json({"auth_code": auth_code})
|
return self.json({"auth_code": auth_code})
|
||||||
|
|
||||||
|
|
||||||
@ -189,6 +192,9 @@ class CoreConfigOnboardingView(_BaseOnboardingView):
|
|||||||
"met", context={"source": "onboarding"}
|
"met", context={"source": "onboarding"}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# pylint: disable=import-outside-toplevel
|
||||||
|
from homeassistant.components import hassio
|
||||||
|
|
||||||
if (
|
if (
|
||||||
hassio.is_hassio(hass)
|
hassio.is_hassio(hass)
|
||||||
and "raspberrypi" in hassio.get_core_info(hass)["machine"]
|
and "raspberrypi" in hassio.get_core_info(hass)["machine"]
|
||||||
@ -238,7 +244,10 @@ class IntegrationOnboardingView(_BaseOnboardingView):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Return authorization code so we can redirect user and log them in
|
# Return authorization code so we can redirect user and log them in
|
||||||
auth_code = auth.create_auth_code(
|
# pylint: disable=import-outside-toplevel
|
||||||
|
from homeassistant.components.auth import create_auth_code
|
||||||
|
|
||||||
|
auth_code = create_auth_code(
|
||||||
hass, data["client_id"], refresh_token.credential
|
hass, data["client_id"], refresh_token.credential
|
||||||
)
|
)
|
||||||
return self.json({"auth_code": auth_code})
|
return self.json({"auth_code": auth_code})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user