summaryrefslogtreecommitdiff
path: root/www/js/DataModel.js
diff options
context:
space:
mode:
authorPliable Pixels <pliablepixels@gmail.com>2018-09-28 14:29:43 -0400
committerPliable Pixels <pliablepixels@gmail.com>2018-09-28 14:29:43 -0400
commitebe04f8fc791413131c37425998be5be4a2ef538 (patch)
treea8f6e6a15c9e3125f20e9081c59755911a8253bb /www/js/DataModel.js
parentd8fea09d65e5207ef8c4fafcddd5fc74a7f7be00 (diff)
#709 dont escape urls in caller, incorporate cordova http ssl and basic auth checks
Diffstat (limited to 'www/js/DataModel.js')
-rw-r--r--www/js/DataModel.js24
1 files changed, 16 insertions, 8 deletions
diff --git a/www/js/DataModel.js b/www/js/DataModel.js
index a92b5453..eeaf2f53 100644
--- a/www/js/DataModel.js
+++ b/www/js/DataModel.js
@@ -202,18 +202,27 @@ angular.module('zmApp.controllers')
*
* @returns
*/
- function setSSLCerts() {
- if (!window.cordova) return;
+ function setCordovaHttpOptions() {
+
+ if (loginData.isUseBasicAuth) {
+ debug ("Cordova HTTP: configuring basic auth");
+ cordova.plugin.http.useBasicAuth(loginData.basicAuthUser, loginData.basicAuthPassword);
+ }
+
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);
+ cordova.plugin.http.setSSLCertMode('nocheck', function() {
+ debug('--> SSL is permissive, will allow any certs. Use at your own risk.');
+ }, function() {
+ console.log('-->Error setting SSL permissive');
+ });
} else {
log(">>>> Enabling strict SSL checking (turn off in Dev Options if you can't connect)");
- cordova.plugins.certificates.trustUnsecureCerts(false);
+
}
}
@@ -1444,10 +1453,9 @@ angular.module('zmApp.controllers')
log("defaultServer configuration NOT found. Keeping login at defaults");
}
- //console.log ("LOGS="+JSON.stringify(loginData.enableLogs));
- // now set up SSL - need to do it after data return
+
// from local forage
- setSSLCerts();
+ if (window.cordova) setCordovaHttpOptions();
// FIXME: HACK: This is the latest entry point into dataModel init, so start portal login after this
@@ -2871,7 +2879,7 @@ angular.module('zmApp.controllers')
$http.get(loginData.apiurl + '/host/logout.json', {
timeout: 7000,
transformResponse: undefined,
- responseType:'text',
+ // responseType:'text',
})
.then(function (s) {
debug("Logout returned... ");