Do not continue processing after redirect

This commit is contained in:
Girish Ramakrishnan
2023-08-11 11:43:26 +05:30
parent 1041b3b8ab
commit cd0b51dac2
2 changed files with 11 additions and 7 deletions

View File

@@ -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) {

View File

@@ -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;