diff options
| author | Pliable Pixels <pliablepixels@gmail.com> | 2017-02-17 09:34:26 -0500 |
|---|---|---|
| committer | Pliable Pixels <pliablepixels@gmail.com> | 2017-02-17 09:34:26 -0500 |
| commit | 4f24f51a5eb31c3c1e93ecbbc65111b0c037ff29 (patch) | |
| tree | 0c8ecdae8c9e20b67f55c6aa67af3e5d57c56b99 /www/js/DataModel.js | |
| parent | 9259570206df3033c40fdb1f753d53911f8e0358 (diff) | |
android and iOS ports now allow for strict SSL checks via setting in dev options. DO NOT ENABLE with self signed certs #455
Diffstat (limited to 'www/js/DataModel.js')
| -rwxr-xr-x | www/js/DataModel.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/www/js/DataModel.js b/www/js/DataModel.js index d2b21c2c..40ed4738 100755 --- a/www/js/DataModel.js +++ b/www/js/DataModel.js @@ -151,6 +151,7 @@ angular.module('zmApp.controllers') 'hideArchived': false, 'videoPlaybackSpeed': 2, 'enableGIFMP4': false, + 'enableStrictSSL': false, }; @@ -161,6 +162,27 @@ angular.module('zmApp.controllers') 'ZM_PATH_ZMS': '' }; + + function setSSLCerts() + { + if (!window.cordova) return; + if (!loginData.enableStrictSSL) + { + + //alert("Enabling insecure SSL"); + log(">>>> Disabling strict SSL checking (turn off in Dev Options if you can't connect)"); + cordova.plugins.certificates.trustUnsecureCerts(true); + + } + else + { + + log(">>>> Enabling strict SSL checking (turn off in Dev Options if you can't connect)"); + cordova.plugins.certificates.trustUnsecureCerts(false); + } + } + + // credit: http://stackoverflow.com/questions/4994201/is-object-empty function isEmpty(obj) { @@ -994,6 +1016,13 @@ angular.module('zmApp.controllers') } + if (typeof loginData.enableStrictSSL == 'undefined') + { + + loginData.enableStrictSSL = false; + + } + log("DataModel init recovered this loginData as " + JSON.stringify(loginData)); } else @@ -1001,6 +1030,11 @@ angular.module('zmApp.controllers') log("defaultServer configuration NOT found. Keeping login at defaults"); } + // now set up SSL - need to do it after data return + // from local forage + setSSLCerts(); + + // FIXME: HACK: This is the latest entry point into dataModel init, so start portal login after this // not the neatest way $rootScope.$emit('init-complete'); |
