Commit 3817f471 authored by JC Brand's avatar JC Brand

Two session related fixes.

* Don't set JID resource when logging in anonymously. The resource will be set by the server.
* Don't wipe the `id` from the session when clearing it.
parent 2fca442f
......@@ -484,7 +484,8 @@ _converse.initConnection = function () {
)
);
} else {
throw new Error("initConnection: this browser does not support websockets and bosh_service_url wasn't specified.");
throw new Error("initConnection: this browser does not support "+
"websockets and bosh_service_url wasn't specified.");
}
}
setUpXMLLogging();
......@@ -507,6 +508,7 @@ async function initUserSession (jid) {
await new Promise(r => _converse.session.fetch({'success': r, 'error': r}));
if (_converse.session.get('active')) {
_converse.session.clear();
_converse.session.save({'id': id});
}
/**
* Triggered once the user's session has been initialized. The session is a
......@@ -521,7 +523,7 @@ async function initUserSession (jid) {
async function setUserJID (jid) {
await initUserSession(jid);
jid = _converse.session.get('jid') || jid;
if (!Strophe.getResourceFromJid(jid)) {
if (_converse.authentication !== _converse.ANONYMOUS && !Strophe.getResourceFromJid(jid)) {
jid = jid.toLowerCase() + _converse.generateResource();
}
// Set JID on the connection object so that when we call
......
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