diff options
| -rw-r--r-- | www/js/DataModel.js | 27 | ||||
| -rw-r--r-- | www/js/app.js | 24 |
2 files changed, 51 insertions, 0 deletions
diff --git a/www/js/DataModel.js b/www/js/DataModel.js index 48a09b52..2068b497 100644 --- a/www/js/DataModel.js +++ b/www/js/DataModel.js @@ -281,6 +281,33 @@ angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ion displayBanner (mytype, mytext, myinterval, mytimer); }, + isReCaptcha: function() + { + var d=$q.defer(); + var myurl =loginData.url; + zmLog ("Checking of reCaptcha is enabled in ZM..."); + $http.get(myurl) + .then (function (success) { + if (success.data.search("g-recaptcha") != -1 ) + { + // recaptcha enable. zmNinja won't work + zmLog ("ZM has recaptcha enabled", "error"); + displayBanner ('error', ['Recaptcha must be disabled in Zoneminder', 'zmNinja will not work with recaptcha'],"",8000); + d.resolve(true); + return (d.promise); + + + } + else + { + d.resolve(false); + zmLog ("ZM has recaptcha disabled - good"); + return (d.promise); + } + }); + return (d.promise); + }, + //----------------------------------------------------------------------------- // Grabs the computed auth key for streaming // FIXME: Currently a hack - does a screen parse - convert to API based support diff --git a/www/js/app.js b/www/js/app.js index 20066d2d..9ccd51f1 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -314,7 +314,31 @@ angular.module('zmApp', [ }); } + ZMDataModel.isReCaptcha() + .then (function(result) { + if (result == true) + { + $ionicLoading.hide(); + ZMDataModel.displayBanner ('error', + ['reCaptcha must be disabled', + ],"",8000); + var alertPopup = $ionicPopup.alert( + { + title: 'reCaptcha enabled', + template: 'Looks like you have enabled reCaptcha. It needs to be turned off for zmNinja to work' + }); + + // close it after 5 seconds + $timeout(function() { + + alertPopup.close(); + },5000); + } + + }); + + var loginData = ZMDataModel.getLogin(); $http({ method: 'POST', |
