diff --git a/src/js/main.js b/src/js/main.js index f33d0777b..adda6fe8c 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -138,7 +138,11 @@ angular.module('Application').controller('MainController', ['$scope', '$route', if (!status.activated) { console.log('Not activated yet, redirecting', status); - window.location.href = status.adminFqdn ? '/setup.html' : '/setupdns.html'; + if (status.webadminStatus.restore.active || status.webadminStatus.restore.error) { + window.location.href = '/restore.html'; + } else { + window.location.href = status.adminFqdn ? '/setup.html' : '/setupdns.html'; + } return; } diff --git a/src/js/restore.js b/src/js/restore.js index d947a5093..181b2a0a6 100644 --- a/src/js/restore.js +++ b/src/js/restore.js @@ -193,8 +193,14 @@ app.controller('RestoreController', ['$scope', '$http', 'Client', function ($sco $scope.busy = true; Client.getStatus(function (error, status) { - if (!error && !status.webadminStatus.restoring) { - window.location.href = '/'; + if (!error && !status.webadminStatus.restore.active) { // restore finished + if (status.webadminStatus.restore.error) { + $scope.busy = false; + $scope.error.generic = status.webadminStatus.restore.error; + } else { // restore worked, redirect to admin page + window.location.href = '/'; + } + return; } setTimeout(waitForRestore, 5000); @@ -225,7 +231,7 @@ app.controller('RestoreController', ['$scope', '$http', 'Client', function ($sco return; } - if (status.restoring) return waitForRestore(); + if (status.webadminStatus.restore.active) return waitForRestore(); if (status.activated) { window.location.href = '/';