diff options
| -rw-r--r-- | www/js/DataModel.js | 13 | ||||
| -rw-r--r-- | www/js/LoginCtrl.js | 3 |
2 files changed, 13 insertions, 3 deletions
diff --git a/www/js/DataModel.js b/www/js/DataModel.js index 7207df83..70fd5caf 100644 --- a/www/js/DataModel.js +++ b/www/js/DataModel.js @@ -213,7 +213,7 @@ angular.module('zmApp.controllers') var tLd = serverGroupList[loginData.serverName]; var keepBuilding = true; - while (keepBuilding==true) + while (keepBuilding==true && tLd) { if (arrayObjectIndexOf(chainURLs,tLd.url,"url") == -1 ) // no loop { @@ -223,6 +223,11 @@ angular.module('zmApp.controllers') if (tLd.fallbackConfiguration) { tLd = serverGroupList [tLd.fallbackConfiguration]; + if (tLd == undefined) + { + // This can happen if the fallback profile was deleted + zmLog ("Looks like a server object was deleted, but is still in fallback"); + } } else { @@ -320,7 +325,11 @@ angular.module('zmApp.controllers') //console.log ("************ FOUND SERVER NAME " + as[x]); // if serverGroupList[x] } - if (!isFoundDemo) + + // Don't add the demo if there is another server + // because this means the user deleted it + + if (!isFoundDemo && as.length == 0) { zmDebug ("Pushing demo server config to server groups"); //serverGroupList.push(demoS); diff --git a/www/js/LoginCtrl.js b/www/js/LoginCtrl.js index 11876862..e91c12d8 100644 --- a/www/js/LoginCtrl.js +++ b/www/js/LoginCtrl.js @@ -2,7 +2,7 @@ /* jslint browser: true*/ /* global cordova,StatusBar,angular,console */ -angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$rootScope', 'zm', '$ionicModal', 'ZMDataModel', '$ionicSideMenuDelegate', '$ionicPopup', '$http', '$q', '$ionicLoading', 'zmAutoLogin', '$cordovaPinDialog', 'EventServer', '$ionicHistory', '$state', '$ionicActionSheet', 'SecuredPopups', function ($scope, $rootScope, zm, $ionicModal, ZMDataModel, $ionicSideMenuDelegate, $ionicPopup, $http, $q, $ionicLoading, zmAutoLogin, $cordovaPinDialog, EventServer, $ionicHistory, $state, $ionicActionSheet, SecuredPopups) { +angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$rootScope', 'zm', '$ionicModal', 'ZMDataModel', '$ionicSideMenuDelegate', '$ionicPopup', '$http', '$q', '$ionicLoading', 'zmAutoLogin', '$cordovaPinDialog', 'EventServer', '$ionicHistory', '$state', '$ionicActionSheet', 'SecuredPopups', '$localstorage', function ($scope, $rootScope, zm, $ionicModal, ZMDataModel, $ionicSideMenuDelegate, $ionicPopup, $http, $q, $ionicLoading, zmAutoLogin, $cordovaPinDialog, EventServer, $ionicHistory, $state, $ionicActionSheet, SecuredPopups, $localstorage) { $scope.openMenu = function () { $ionicSideMenuDelegate.toggleLeft(); }; @@ -137,6 +137,7 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r //console.log ("YOU WANT TO DELETE " + $scope.loginData.serverName); //console.log ("LENGTH OF SERVERS IS " + Object.keys(zmServers).length); if (Object.keys(zmServers).length > 1) { + ZMDataModel.zmLog("Deleting " + $scope.loginData.serverName); delete zmServers[$scope.loginData.serverName]; ZMDataModel.setServerGroups(zmServers); |
