From 691b1880c0c10e4295a1035ec71226f5a6497900 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Thu, 6 Sep 2018 12:47:15 +0200 Subject: [PATCH 1/2] Redirect to onboarding from auth page --- src/auth/ha-authorize.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/auth/ha-authorize.js b/src/auth/ha-authorize.js index 4fa00a5f21eb..949a11b0dd45 100644 --- a/src/auth/ha-authorize.js +++ b/src/auth/ha-authorize.js @@ -92,6 +92,14 @@ class HaAuthorize extends LocalizeLiteMixin(PolymerElement) { // Fetch auth providers try { const response = await window.providersPromise; + const result = await response.json(); + + // Forward to main screen which will redirect to right onboarding page. + if (response.status === 400 && result.code === 'onboarding_required') { + location.href = '/'; + return; + } + const authProviders = await response.json(); if (authProviders.length === 0) { @@ -104,6 +112,9 @@ class HaAuthorize extends LocalizeLiteMixin(PolymerElement) { _authProvider: authProviders[0], }); } catch (err) { + if (response && response.status) { + + } // eslint-disable-next-line console.error('Error loading auth providers', err); this._state = 'error-loading'; From d876f3326797348e5c921a392df939cc23a47d3e Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Fri, 7 Sep 2018 19:42:16 +0200 Subject: [PATCH 2/2] Remove left over trial code --- src/auth/ha-authorize.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/auth/ha-authorize.js b/src/auth/ha-authorize.js index 949a11b0dd45..a1e01d387fbe 100644 --- a/src/auth/ha-authorize.js +++ b/src/auth/ha-authorize.js @@ -112,9 +112,6 @@ class HaAuthorize extends LocalizeLiteMixin(PolymerElement) { _authProvider: authProviders[0], }); } catch (err) { - if (response && response.status) { - - } // eslint-disable-next-line console.error('Error loading auth providers', err); this._state = 'error-loading';