summaryrefslogtreecommitdiff
path: root/www/js/LoginCtrl.js
diff options
context:
space:
mode:
authorpliablepixels <pliablepixels@gmail.com>2016-03-18 14:35:57 -0400
committerpliablepixels <pliablepixels@gmail.com>2016-03-18 14:35:57 -0400
commit0948cb4d472784946a6d54e4797d20183cdcc799 (patch)
tree2c4752351647aa39a74dbdaf1c10e7fb49fe7b83 /www/js/LoginCtrl.js
parent5f9ebde8b9f0cb91e087ca829489ea5ff2af18ba (diff)
#133 - don't know what the hell is going on, except this helps
Former-commit-id: f6fee6f649dab2763ebbf96ca74e7edf8f55b0f2
Diffstat (limited to 'www/js/LoginCtrl.js')
-rw-r--r--www/js/LoginCtrl.js16
1 files changed, 15 insertions, 1 deletions
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)