diff options
| author | Pliable Pixels <pliablepixels@gmail.com> | 2018-07-12 16:55:38 -0400 |
|---|---|---|
| committer | Pliable Pixels <pliablepixels@gmail.com> | 2018-07-12 16:55:38 -0400 |
| commit | 50b55314c2b6c3e576b19a21388441cf3e5ae798 (patch) | |
| tree | 410b7aa12c54df0f5892c2aa632216dcaa8570d8 /www/js/DataModel.js | |
| parent | 8c280aa571af3653a62842679facf6cc03fb909a (diff) | |
#668 logout via API and keep state
Diffstat (limited to 'www/js/DataModel.js')
| -rwxr-xr-x | www/js/DataModel.js | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/www/js/DataModel.js b/www/js/DataModel.js index ad0ab6e1..2323c27e 100755 --- a/www/js/DataModel.js +++ b/www/js/DataModel.js @@ -176,6 +176,7 @@ angular.module('zmApp.controllers') 'showLiveForInProgressEvents': true, 'disableSimulStreaming': false, 'insertBasicAuthToken': false, + 'loginAPISupported': false, }; @@ -347,7 +348,7 @@ angular.module('zmApp.controllers') // disable for now, getAuthHash needs work - if (versionCompare(currentServerVersion, "1.31.44") != -1) { + if (versionCompare(currentServerVersion, "1.31.44") != -1 || loginData.loginAPISupported) { myurl = loginData.apiurl + '/host/getCredentials.json'; debug("Server version > 1.31.41, so using getCredentials API:" + myurl); @@ -1298,6 +1299,13 @@ angular.module('zmApp.controllers') } + + if (typeof loginData.loginAPISupported == 'undefined') { + + loginData.loginAPISupported = false; + + } + loginData.canSwipeMonitors = true; loginData.forceImageModePath = false; loginData.enableBlog = true; @@ -2629,6 +2637,28 @@ angular.module('zmApp.controllers') log(loginData.url + "=>Logging out of any existing ZM sessions..."); $rootScope.authSession = "undefined"; + + if (versionCompare(currentServerVersion, "1.31.44") != -1 || loginData.loginAPISupported) { + + debug ("Logging out using API method"); + $http.get(loginData.apiurl+'/host/logout.json') + .then (function(s) { + debug ("Logout returned "+JSON.stringify(s)); + d.resolve(true); + return d.promise; + }, + function (e) { + debug ("Logout errored "+JSON.stringify(e)); + d.resolve(true); + return d.promise; + } + ); + return d.promise; + } + + + // old logout mode + debug ("Logging out using Web method"); $http({ method: 'POST', timeout: 10000, |
