From 300425e698bf57ff3b6fb97604f491457e08a57d Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Fri, 7 Sep 2018 20:13:00 +0200 Subject: [PATCH] Redirect to onboarding from auth page (#1640) * Redirect to onboarding from auth page * Remove left over trial code --- src/auth/ha-authorize.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/auth/ha-authorize.js b/src/auth/ha-authorize.js index 4fa00a5f21..a1e01d387f 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) {