summaryrefslogtreecommitdiff
path: root/www/js
diff options
context:
space:
mode:
Diffstat (limited to 'www/js')
-rw-r--r--www/js/MontageCtrl.js2
-rwxr-xr-xwww/js/app.js21
2 files changed, 17 insertions, 6 deletions
diff --git a/www/js/MontageCtrl.js b/www/js/MontageCtrl.js
index a906ec50..b0bf2cda 100644
--- a/www/js/MontageCtrl.js
+++ b/www/js/MontageCtrl.js
@@ -622,7 +622,7 @@ angular.module('zmApp.controllers')
apiurl += '.json?sort=StartTime&direction=desc&limit=1'+$rootScope.authSession;
- NVR.debug ("Getting event count ");
+ //NVR.debug ("Getting event count ");
$http.get(apiurl)
.then (function (data) {
// console.log ("EVENTS GOT: "+JSON.stringify(data));
diff --git a/www/js/app.js b/www/js/app.js
index c6ed9644..c2540b8e 100755
--- a/www/js/app.js
+++ b/www/js/app.js
@@ -164,8 +164,8 @@ angular.module('zmApp', [
});
return out;
- };
+ };
})
// filter for montage iteration
@@ -842,9 +842,13 @@ angular.module('zmApp', [
//------------------------------------------------------------------
$rootScope.$on("token-expiry", function () {
- NVR.log ('-----> Access token is about to expire, re-doing login');
- _doLogin("");
-
+ if ($rootScope.loginInProgress) {
+ NVR.log ('-----> got token expiry broadcast, but login in progress, not acting');
+ } else {
+ NVR.log ('-----> Access token is about to expire, re-doing login');
+ _doLogin("");
+ }
+
});
$rootScope.$on("auth-error", function () {
@@ -1001,10 +1005,14 @@ angular.module('zmApp', [
function _doLogin(str) {
+
+
var d = $q.defer();
+ $rootScope.loginInProgress = true;
if ($rootScope.userCancelledAuth) {
NVR.debug ('_doLogin - not proceeding as user cancelled auth');
+ $rootScope.loginInProgress = false;
d.reject(false);
return d.promise;
}
@@ -1040,6 +1048,7 @@ angular.module('zmApp', [
alertPopup.close();
}, 5000);
+ $rootScope.loginInProgress = false;
d.reject("Error-disable recaptcha");
return (d.promise);
}
@@ -1057,12 +1066,14 @@ angular.module('zmApp', [
//NVR.debug("Storing login time as " + moment().toString());
localforage.setItem("lastLogin", moment().toString());
+ $rootScope.loginInProgress = false;
d.resolve(success);
return d.promise;
},
function (error)
{
$ionicLoading.hide();
+ $rootScope.loginInProgress = false;
d.reject(error);
return d.promise;
});
@@ -1122,7 +1133,6 @@ angular.module('zmApp', [
//console.log(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>INSIDE RUN");
- NVR.log("******* app .run device ready");
$fileLogger.setStorageFilename(zm.logFile);
$fileLogger.setTimestampFormat('MMM d, y ' + NVR.getTimeFormatMilliSec());
@@ -1138,6 +1148,7 @@ angular.module('zmApp', [
});
+ NVR.log("******* app .run device ready");
$rootScope.dpadId = 0;
$rootScope.textScaleFactor = 1.0;