diff --git a/dashboard/src/js/main.js b/dashboard/src/js/main.js index 439bd4d9e..0bd1106cb 100644 --- a/dashboard/src/js/main.js +++ b/dashboard/src/js/main.js @@ -126,15 +126,17 @@ angular.module('Application').controller('MainController', ['$scope', '$route', } else { window.location.href = '/setupdns.html' + window.location.search; } - return; + return true; } // support local development with localhost check if (window.location.hostname !== status.adminFqdn && window.location.hostname !== 'localhost' && !window.location.hostname.startsWith('192.')) { // user is accessing by IP or by the old admin location (pre-migration) window.location.href = '/setupdns.html' + window.location.search; - return; + return true; } + + return false; } // this loads the very first thing when accessing via IP or domain @@ -142,7 +144,7 @@ angular.module('Application').controller('MainController', ['$scope', '$route', Client.getProvisionStatus(function (error, status) { if (error) return Client.initError(error, init); - redirectIfNeeded(status); + if (redirectIfNeeded(status)) return; // check version and force reload if needed if (!localStorage.version) { diff --git a/dashboard/src/js/setup.js b/dashboard/src/js/setup.js index 2fa41de95..d96d7dac3 100644 --- a/dashboard/src/js/setup.js +++ b/dashboard/src/js/setup.js @@ -74,19 +74,21 @@ app.controller('SetupController', ['$scope', 'Client', function ($scope, Client) // if we are here from https://ip/setup.html ,go to https://admin/setup.html if (status.adminFqdn && status.adminFqdn !== window.location.hostname) { window.location.href = 'https://' + status.adminFqdn + '/setup.html'; - return; + return true; } // if we don't have a domain yet, first go to domain setup if (!status.adminFqdn) { window.location.href = '/setupdns.html'; - return; + return true; } if (status.activated) { window.location.href = '/'; - return; + return true; } + + return false; } function setView(view) { @@ -101,7 +103,7 @@ app.controller('SetupController', ['$scope', 'Client', function ($scope, Client) Client.getProvisionStatus(function (error, status) { if (error) return Client.initError(error, init); - redirectIfNeeded(status); + if (redirectIfNeeded(status)) return; setView(search.view); $scope.setupToken = search.setupToken;