From 00c98cae610c0985c69b3b7bdb078cfbd354df0a Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Mon, 22 Oct 2018 14:56:10 -0400 Subject: clear cookies in desktop too --- www/js/app.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'www/js/app.js') diff --git a/www/js/app.js b/www/js/app.js index fd772197..993e5fff 100755 --- a/www/js/app.js +++ b/www/js/app.js @@ -28,7 +28,8 @@ angular.module('zmApp', [ 'uk.ac.soton.ecs.videogular.plugins.cuepoints', 'dcbImgFallback', 'ngImageAppear', - 'angular-websocket' + 'angular-websocket', + 'ngCookies' ]) @@ -860,7 +861,7 @@ angular.module('zmApp', [ // This service automatically logs into ZM at periodic intervals //------------------------------------------------------------------ - .factory('zmAutoLogin', function ($interval, NVRDataModel, $http, zm, $browser, $timeout, $q, $rootScope, $ionicLoading, $ionicPopup, $state, $ionicContentBanner, EventServer, $ionicHistory, $translate) { + .factory('zmAutoLogin', ['$interval', 'NVRDataModel', '$http', 'zm', '$timeout', '$q', '$rootScope', '$ionicLoading', '$ionicPopup', '$state', '$ionicContentBanner', 'EventServer', '$ionicHistory', '$translate', '$cookies',function ($interval, NVRDataModel, $http, zm, $timeout, $q, $rootScope, $ionicLoading, $ionicPopup, $state, $ionicContentBanner, EventServer, $ionicHistory, $translate, $cookies) { var zmAutoLoginHandle; //------------------------------------------------------------------ @@ -966,12 +967,19 @@ angular.module('zmApp', [ function doLogoutAndLogin(str) { + NVRDataModel.debug ("Clearing cookies"); + if (window.cordova) { // we need to do this or ZM will send same auth hash // this was fixed in a PR dated Oct 18 - NVRDataModel.debug ("Clearing cookies"); + cordova.plugin.http.clearCookies(); } + else { + angular.forEach($cookies, function (v, k) { + $cookies.remove(k); + }); + } return NVRDataModel.logout() .then(function (ans) { return doLogin(str); @@ -1417,7 +1425,7 @@ angular.module('zmApp', [ stop: stop, doLogin: doLogoutAndLogin }; - }) + }]) //==================================================================== // First run in ionic -- cgit v1.2.3