From bff6127032bd5155e4f9715d08b9693b5a2af913 Mon Sep 17 00:00:00 2001 From: Arjun Roychowdhury Date: Thu, 24 Dec 2015 17:33:18 -0500 Subject: #122 - you can cancel auth attempts and go directly to login Former-commit-id: 874cf34492aa09f69952a81c29626a9997f63602 --- www/js/app.js | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'www/js/app.js') diff --git a/www/js/app.js b/www/js/app.js index ab2d5f90..5b536932 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -89,6 +89,7 @@ angular.module('zmApp', [ }) + //------------------------------------------------------------------ // I use this factory to share data between carousel and lazy load // carousel will not progress autoslide till imageLoading is 0 or -1 @@ -591,7 +592,7 @@ angular.module('zmApp', [ //==================================================================== -.run(function ($ionicPlatform, $ionicPopup, $rootScope, zm, $state, $stateParams, ZMDataModel, $cordovaSplashscreen, $http, $interval, zmAutoLogin, zmCheckUpdates, $fileLogger, $timeout, $ionicHistory, $window, $ionicSideMenuDelegate, EventServer,$ionicContentBanner) { +.run(function ($ionicPlatform, $ionicPopup, $rootScope, zm, $state, $stateParams, ZMDataModel, $cordovaSplashscreen, $http, $interval, zmAutoLogin, zmCheckUpdates, $fileLogger, $timeout, $ionicHistory, $window, $ionicSideMenuDelegate, EventServer,$ionicContentBanner, $ionicLoading) { @@ -612,6 +613,7 @@ angular.module('zmApp', [ $rootScope.currentServerGroup = "defaultServer"; $rootScope.validMonitorId = ""; $rootScope.newVersionAvailable = ""; + $rootScope.userCancelledAuth = false; //$rootScope.minAlarmCount = "1"; @@ -650,6 +652,22 @@ angular.module('zmApp', [ window.addEventListener("resize", checkOrientation, false); + + // we come here when a user forcibly cancels portal auth + // useful when you know your auth won't succeed and you need to + // switch to another server + $rootScope.cancelAuth = function() + { + $ionicLoading.hide(); + ZMDataModel.zmLog("User cancelled login"); + $ionicHistory.nextViewOptions({ + disableAnimate: true, + disableBack: true + }); + $state.go("login"); + $rootScope.userCancelledAuth = true; + }; + //--------------------------------------------------------------------------- // authorize state transitions //---------------------------------------------------------------------------- @@ -694,6 +712,9 @@ angular.module('zmApp', [ $ionicPlatform.ready(function () { $rootScope.platformOS = "desktop"; + + + ZMDataModel.zmLog("Device is ready"); var ld = ZMDataModel.getLogin(); -- cgit v1.2.3