Commit 3c9b5bd7 authored by JC Brand's avatar JC Brand

More work on session management.

When it's not possible to reconnect due to password no longer being cached,
render the login form.

Fixed a bug whereby after one failed reconnection event, reconnection becomes
impossible (due to 'connection' state of the controlbox).
parent f5b182c3
......@@ -64,7 +64,13 @@
},
afterReconnected: function () {
view.model.set({connected:true});
this._super.afterReconnected.apply(this, arguments);
var view = converse.chatboxviews.get('controlbox');
if (view.model.get('connected')) {
converse.chatboxviews.get("controlbox").onConnected();
} else {
view.model.set({connected:true});
}
},
_tearDown: function () {
......
......@@ -409,8 +409,7 @@
converse.connection.reset();
converse.log('The connection has dropped, attempting to reconnect.');
converse.giveFeedback(
__("Reconnecting"), 'warn',
__('The connection has dropped, attempting to reconnect.')
__("Reconnecting"), 'warn', __('The connection has dropped, attempting to reconnect.')
);
converse.clearSession();
converse._tearDown();
......@@ -1764,8 +1763,13 @@
} else if (this.authentication === converse.LOGIN) {
var password = converse.connection.pass || this.password;
if (!password) {
throw new Error("initConnection: If you use auto_login and "+
"authentication='login' then you also need to provide a password.");
if (this.auto_login && !this.password) {
throw new Error("initConnection: If you use auto_login and "+
"authentication='login' then you also need to provide a password.");
}
converse.disconnection_cause = Strophe.Status.AUTHFAIL;
converse.onDisconnected();
converse.giveFeedback(''); // Wipe the feedback
}
var resource = Strophe.getResourceFromJid(this.jid);
if (!resource) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment