From 0948cb4d472784946a6d54e4797d20183cdcc799 Mon Sep 17 00:00:00 2001 From: pliablepixels Date: Fri, 18 Mar 2016 14:35:57 -0400 Subject: #133 - don't know what the hell is going on, except this helps Former-commit-id: f6fee6f649dab2763ebbf96ca74e7edf8f55b0f2 --- www/js/LoginCtrl.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'www/js/LoginCtrl.js') diff --git a/www/js/LoginCtrl.js b/www/js/LoginCtrl.js index 040dd2f9..11876862 100644 --- a/www/js/LoginCtrl.js +++ b/www/js/LoginCtrl.js @@ -105,6 +105,7 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r var zmServers = ZMDataModel.getServerGroups(); $scope.loginData = zmServers[serverbuttons[index].text]; + console.log ("NEW LOOGIN OBJECT IS " + JSON.stringify($scope.loginData)); $scope.check.isUseAuth = ($scope.loginData.isUseAuth == '1') ? true : false; @@ -336,6 +337,7 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r function saveItems(showalert) { + console.log ("*********** SAVE ITEMS CALLED "); //console.log('Saving login'); ZMDataModel.setFirstUse(false); @@ -418,7 +420,7 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r if ($scope.check.isUseAuth) { if (!$scope.loginData.username) $scope.loginData.username = "x"; if (!$scope.loginData.password) $scope.loginData.password = "x"; - ZMDataModel.zmLog("Authentication is disabled, setting dummy user & pass"); + //ZMDataModel.zmLog("Authentication is disabled, setting dummy user & pass"); } if (parseInt($scope.loginData.maxMontage) <= 0) { @@ -501,6 +503,18 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r .then(function (data) { // Now let's validate if the API works + + // note that due to reachability, it might have switched to another server + + if ($scope.loginData.serverName != ZMDataModel.getLogin().serverName) + { + ZMDataModel.zmDebug (">>> Server information has changed, likely a fallback took over!"); + $scope.loginData = ZMDataModel.getLogin(); + apiurl = $scope.loginData.apiurl + '/host/getVersion.json'; + portalurl = $scope.loginData.url + '/index.php'; + } + + ZMDataModel.zmLog("Validating APIs at " + apiurl); $http.get(apiurl) -- cgit v1.2.3