From a09333e8b97a5f5c71331ce18777889510aed302 Mon Sep 17 00:00:00 2001 From: PliablePixels Date: Tue, 11 Aug 2015 15:47:11 -0400 Subject: API auth tied into ZM auth, enabled client to work in both auth and non-auth mode honoring ZM's auth system --- www/js/DataModel.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'www/js/DataModel.js') diff --git a/www/js/DataModel.js b/www/js/DataModel.js index 0d9d6ca8..e61ef052 100644 --- a/www/js/DataModel.js +++ b/www/js/DataModel.js @@ -24,7 +24,8 @@ angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ion 'maxFPS': "3", // image streaming FPS 'montageQuality': "50", // montage streaming quality in % 'useSSL':false, // "1" if HTTPS - 'keepAwake':true // don't dim/dim during live view + 'keepAwake':true, // don't dim/dim during live view + 'isUseAuth':true // true if user wants ZM auth }; var configParams = { 'ZM_EVENT_IMAGE_DIGITS':'-1' @@ -64,6 +65,19 @@ angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ion console.log("****** DATAMODEL INIT SERVICE CALLED ********"); zmLog("ZMData init: checking for stored variables & setting up log file"); + + if (window.localStorage.getItem("isUseAuth") != undefined) { + loginData.isUseAuth = + window.localStorage.getItem("isUseAuth"); + + } + else + { + loginData.isUseAuth = "1"; // lets assume there is auth + zmLog("I did not find isUseAuth. Older version of app, maybe."); + } + + if (window.localStorage.getItem("username") != undefined) { loginData.username = @@ -142,7 +156,7 @@ angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ion }, isLoggedIn: function () { - if (loginData.username != "" && loginData.password != "" && loginData.url != "" && loginData.apiurl != "") + if ( (loginData.username != "" && loginData.password != "" && loginData.url != "" && loginData.apiurl != "") || (loginData.isUseAuth == '0')) { return 1; } else @@ -218,6 +232,9 @@ angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ion window.localStorage.setItem("keepAwake", loginData.keepAwake?"1":"0"); window.localStorage.setItem("maxMontage", loginData.maxMontage); window.localStorage.setItem("montageQuality", loginData.montageQuality); + window.localStorage.setItem("isUseAuth", loginData.isUseAuth); + + console.log ("***** SETTING ISUSEAUTH TO " + loginData.isUseAuth); if (loginData.maxFPS > 30) { -- cgit v1.2.3