diff --git a/docs/CHANGES.md b/docs/CHANGES.md index d31ae4007..b3d483db6 100755 --- a/docs/CHANGES.md +++ b/docs/CHANGES.md @@ -1,12 +1,13 @@ # Changelog -## 2.0.5 +## 2.0.5 (Unreleased) - #743, #751, #753 Update to Strophe 1.2.12. SASL-EXTERNAL now has reduced priority, so it won't be prioritized above other auth mechanisms. [jcbrand] - #755: create composer.json to add this project in packagist.org [fabiomontefuscolo] - #758: Bugfix. Render all resize drag handles for ChatRoomView. [LeoYReyes] - Bugfix. Cancel button shown while registration form is being fetched wasn't working properly. [jcbrand] +- Bugfix. Login form wasn't rendered after logging out (when `auto_reconnect` is `true`). [jcbrand] ## 2.0.4 (2016-12-13) - #737: Bugfix. Translations weren't being applied. [jcbrand] diff --git a/src/converse-core.js b/src/converse-core.js index b3295cf68..d083ba485 100755 --- a/src/converse-core.js +++ b/src/converse-core.js @@ -407,7 +407,7 @@ converse.connection.reset(); converse._tearDown(); converse.logIn(null, true); - }, 1000); + }, 1000, {'leading': true}); this.disconnect = function () { delete converse.connection.reconnecting; @@ -419,19 +419,20 @@ }; this.onDisconnected = function (condition) { - if (converse.disconnection_cause !== converse.LOGOUT && converse.auto_reconnect) { - if (converse.disconnection_cause === Strophe.Status.CONNFAIL) { - converse.reconnect(condition); - converse.log('RECONNECTING'); - } else if (converse.disconnection_cause === Strophe.Status.DISCONNECTING || - converse.disconnection_cause === Strophe.Status.DISCONNECTED) { - window.setTimeout(_.partial(converse.reconnect, condition), 3000); - converse.log('RECONNECTING IN 3 SECONDS'); - } - converse.emit('reconnecting'); - return 'reconnecting'; + if (_.includes([converse.LOGOUT, Strophe.Status.AUTHFAIL], converse.disconnection_cause) || + !converse.auto_reconnect) { + return this.disconnect(); } - return this.disconnect(); + if (converse.disconnection_cause === Strophe.Status.CONNFAIL) { + converse.reconnect(condition); + converse.log('RECONNECTING'); + } else if (converse.disconnection_cause === Strophe.Status.DISCONNECTING || + converse.disconnection_cause === Strophe.Status.DISCONNECTED) { + window.setTimeout(_.partial(converse.reconnect, condition), 3000); + converse.log('RECONNECTING IN 3 SECONDS'); + } + converse.emit('reconnecting'); + return 'reconnecting'; }; this.setDisconnectionCause = function (connection_status) {