diff options
| author | Pliable Pixels <pliablepixels@gmail.com> | 2020-10-18 10:47:55 -0400 |
|---|---|---|
| committer | Pliable Pixels <pliablepixels@gmail.com> | 2020-10-18 10:47:55 -0400 |
| commit | 0bfbc9753d456b3e02c061c01fe767b9872ec726 (patch) | |
| tree | 7bbcdf1853f666544e31ded932c1946f3adf8bb1 /www | |
| parent | 7419d7de1b034c5c04bec9cf05ed300d88a932c3 (diff) | |
don't act on token expiry broadcast if another login session is in progress
Diffstat (limited to 'www')
| -rw-r--r-- | www/js/MontageCtrl.js | 2 | ||||
| -rwxr-xr-x | www/js/app.js | 21 |
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; |
