diff options
| author | Pliable Pixels <pliablepixels@gmail.com> | 2019-08-11 17:12:52 -0400 |
|---|---|---|
| committer | Pliable Pixels <pliablepixels@gmail.com> | 2019-08-11 17:12:52 -0400 |
| commit | 5a81200bd99bd176a303d5ee05359d304fa499b8 (patch) | |
| tree | ddca239b523614b1174340599e6769dd2addbcd6 /www/js/NVR.js | |
| parent | b36c596f4350ba7e8772044c6601ca5404de1dde (diff) | |
#842 - my code is a huge ness.
Diffstat (limited to 'www/js/NVR.js')
| -rw-r--r-- | www/js/NVR.js | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/www/js/NVR.js b/www/js/NVR.js index 0f5a0656..68d90ab8 100644 --- a/www/js/NVR.js +++ b/www/js/NVR.js @@ -399,7 +399,9 @@ angular.module('zmApp.controllers') var httpDelay = loginData.enableSlowLoading ? zm.largeHttpTimeout : zm.httpTimeout; - str = $translate.instant('kAuthenticating'); + str = "<a style='color:white; text-decoration:none' href='#' ng-click='$root.cancelAuth()' <i class='ion-close-circled'></i> " + $translate.instant('kAuthenticating')+"</a>"; + + if (str) { $ionicLoading.show({ @@ -590,16 +592,23 @@ angular.module('zmApp.controllers') function loginWebScrape(noBroadcast) { var d = $q.defer(); + if ($rootScope.userCancelledAuth) { + debug ('NVR loginWebScrape: User cancelled auth, not proceeding'); + d.reject(true); + return d.promise; + } debug("Logging in using old web-scrape method"); $ionicLoading.show({ - template: $translate.instant('kAuthenticatingWebScrape'), + + template: "<a style='color:white; text-decoration:none' href='#' ng-click='$root.cancelAuth()' <i class='ion-close-circled'></i> " + $translate.instant('kAuthenticatingWebScrape')+"</a>", noBackdrop: true, duration: httpDelay }); - + + var httpDelay = loginData.enableSlowLoading ? zm.largeHttpTimeout : zm.httpTimeout; //NVR.debug ("*** AUTH LOGIN URL IS " + loginData.url); @@ -1793,8 +1802,12 @@ angular.module('zmApp.controllers') function findFirstReachableUrl(urls) { if (urls.length > 0 && $rootScope.userCancelledAuth != true) { + + + $ionicLoading.show({ - template: $translate.instant('kTrying') + ' ' + urls[0].server + template: "<a style='color:white; text-decoration:none' href='#' ng-click='$root.cancelAuth()' <i class='ion-close-circled'></i> " + $translate.instant('kTrying')+ ' ' + urls[0].server+"</a>", + noBackdrop: true, }); log("Reachability test.." + urls[0].url); @@ -2958,9 +2971,10 @@ angular.module('zmApp.controllers') }, diff_access * 60 * 1000); - // console.log ("**************** TOKEN SET="+loginData.accessToken); + $rootScope.authSession = '&token='+loginData.accessToken; d.resolve("Login success via access token"); + console.log ("**************** TOKEN SET="+$rootScope.authSession); if (!noBroadcast) $rootScope.$broadcast('auth-success', '' ); return d.promise; } @@ -3623,7 +3637,11 @@ angular.module('zmApp.controllers') logout: function () { var d = $q.defer(); - + if ($rootScope.userCancelledAuth) { + debug ('NVR logout: User cancelled auth, not proceeding'); + d.reject(true); + return d.promise; + } // always resolves if (!loginData.isUseAuth || loginData.isTokenSupported) { log("No need for logout!"); @@ -3631,8 +3649,13 @@ angular.module('zmApp.controllers') return d.promise; } + + // $ionicLoading.show({ template: '<button class="button button-clear" style="line-height: normal; min-height: 0; min-width: 0;" ng-click="$root.cancel()"></button><i class="icon ion-chevron-up"></i> Loading...' }); + + $ionicLoading.show({ - template: $translate.instant('kCleaningUp'), + //template:$translate.instant('kCleaningUp'), + template: "<a style='color:white; text-decoration:none' href='#' ng-click='$root.cancelAuth()' <i class='ion-close-circled'></i> " + $translate.instant('kCleaningUp')+"</a>", noBackdrop: true, }); |
