diff options
Diffstat (limited to 'js/codeq')
-rw-r--r-- | js/codeq/comms.js | 21 | ||||
-rw-r--r-- | js/codeq/core.js | 7 |
2 files changed, 25 insertions, 3 deletions
diff --git a/js/codeq/comms.js b/js/codeq/comms.js index e964f20..5e046b7 100644 --- a/js/codeq/comms.js +++ b/js/codeq/comms.js @@ -557,6 +557,27 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ 'samlLogout': function(){ return this.send({'action':'saml_logout'}); + }, + + 'forceReset': function () { + var p; + if (sid !== null) { + p = Q.Promise(function (resolve, reject, notify) { + var t = setTimeout(function () { + t = null; + resolve(); + }, 3000); // 3 seconds + codeq.comms.logout().then(function () { + if (t !== null) { + clearTimeout(t); + t = null; + resolve(); + } + }); + }); + } + else p = Q(); + return p.fin(codeq.comms.disconnect); } }; })(); diff --git a/js/codeq/core.js b/js/codeq/core.js index 22f6a50..c3c657f 100644 --- a/js/codeq/core.js +++ b/js/codeq/core.js @@ -610,15 +610,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ codeq.log.info('App reset: ' + (reason || 'no reason given')); codeq.globalStateMachine.transition('login'); codeq.wait( - codeq.comms.getSid() == null ? Q() : codeq.comms.logout() +/* codeq.comms.getSid() == null ? Q() : codeq.comms.logout() .finally( codeq.comms.disconnect ) .fail(function (e) { codeq.log.debug(e) - }) // ignore errors + }) // ignore errors*/ + codeq.comms.forceReset ) - .then(function () { + .fin(function () { if (reason) { alert(reason); } |