Skip to content

Commit

Permalink
#635 promise cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
pliablepixels committed May 24, 2018
1 parent 8b7ca64 commit e5d36a0
Show file tree
Hide file tree
Showing 4 changed files with 241 additions and 250 deletions.
2 changes: 1 addition & 1 deletion config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget android-packageName="com.pliablepixels.zmninja_pro" id="com.pliablepixels.zmninjapro" ios-CFBundleIdentifier="com.pliablepixels.zmninja-pro" version="1.3.001" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget android-packageName="com.pliablepixels.zmninja_pro" id="com.pliablepixels.zmninjapro" ios-CFBundleIdentifier="com.pliablepixels.zmninja-pro" version="1.3.002" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>zmNinja</name>
<description>
High performance ZoneMinder client
Expand Down
10 changes: 10 additions & 0 deletions www/js/DataModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -1594,12 +1594,15 @@ angular.module('zmApp.controllers')
},

isReCaptcha: function () {
// always resolves
var d = $q.defer();

var myurl = loginData.url;
log("Checking if reCaptcha is enabled in ZM...");
console.log ("Recaptcha: "+myurl);
$http.get(myurl)
.then(function (success) {
console.log ("Inside recaptcha success");
if (success.data.search("g-recaptcha") != -1) {
// recaptcha enable. zmNinja won't work
log("ZM has recaptcha enabled", "error");
Expand All @@ -1612,6 +1615,13 @@ angular.module('zmApp.controllers')
log("ZM has recaptcha disabled - good");
return (d.promise);
}
},
function (err) {
// for whatever reason recaptcha check failed
console.log ("Inside recaptcha fail");
d.resolve(false);
log("Recaptcha failed, but assuming ZM has recaptcha disabled");
return (d.promise);
});
return (d.promise);
},
Expand Down
2 changes: 2 additions & 0 deletions www/js/LoginCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,8 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r

.then(function (data) {

console.log ("DOLOGIN RETURNED "+ JSON.stringify(data));

// Now let's validate if the API works

// note that due to reachability, it might have switched to another server
Expand Down
Loading

0 comments on commit e5d36a0

Please sign in to comment.