Closed aacunha closed 6 years ago
Can you check if you have any errors in your javascript console?
no error on console
solved in my enviroment changing the switch in function on_render_page($args) to (in this mode the chat is loaded in every page, even on plugins page as calendar, password, managesieve, etc):
function on_render_page($args) {
switch($args['template']) {
case 'login':
$this->load_jsxc();
break;
case 'logoff':
$this->api->output->add_script("
e.stopPropagation();
e.preventDefault();
if (jsxc.xmpp.conn != null) {
$(document).on('disconnected.jsxc', onclick);
jsxc.xmpp.logout(true);
}
", 'foot');
break;
case 'mail':
case 'calendar':
case 'compose':
case 'addressbook':
case 'settings':
case 'folders':
case 'identities':
case 'responses':
case 'about':
$this->load_jsxc();
$this->api->output->add_script("
$('.button-logout').each(function(i, b) {
var onclick = b.onclick;
b.onclick = function(e) {
e.stopPropagation();
e.preventDefault();
if (jsxc.xmpp.conn != null) {
$(document).on('disconnected.jsxc', onclick);
jsxc.xmpp.logout(true);
} else {
onclick();
}
}
});
", 'foot');
break;
default:
$this->load_jsxc();
$this->api->output->add_script("
$('.button-logout').each(function(i, b) {
var onclick = b.onclick;
b.onclick = function(e) {
e.stopPropagation();
e.preventDefault();
if (jsxc.xmpp.conn != null) {
$(document).on('disconnected.jsxc', onclick);
jsxc.xmpp.logout(true);
} else {
onclick();
}
}
});
", 'foot');
break;
}
}
@aacunha ,
The reason to restrict JSXC plugin to the explicit list of tepmlates like mail/calendar/compose/etc. was to avoid loading JSXC in iframes (message preview, contact details etc.) By copying the code to the "default" case you've effectively enabled JSXC on every template, including iframes.
In older versions of JSXC, this resulted in roster showing both in the main RC window and inside message preview. In 3.3.x, it fails to show, but the JSXC code is still loaded, which affects overall performance.
Meanwhile, I've implemented more concise and universal approach without explicit list of allowed templates. Could you please test it from git master?
@aacunha , just curious, what was the reason to introduce the "logoff" case? From my experience, logout functionality works OK without this modification.
@dteleguin Really just letting the default work, actually had done that after closing the issue. I had included the logoff code to "force" terminate the xmpp connection, as some users end up opening webmail in 2 browser tabs, generating unexpected results. It would just be a way to prevent the plugin from loading inappropriately on the login page.
As I emailed you, how could I not load the plugin on the login screen? We use authentication plugins such as rcguard and twofactor_gauthenticator, and jsxc ends up loading when the user, for example, misses the password a few times and falls into the captcha, enters the correct password after that and forgets to validate the captcha.
in the Two factor if the browser is not saved, jsxc also still loads in the login screen.
Would I have to avoid such cases? I tried in jsxc.php not to load the plugin in the "login" screen, but this way the plugin loads into the "mail" screen without the user credentials, so the xmpp session does not start.
@aacunha , I think I've understood the problem. Simply put, if the login process is comprised of several phases, like login+password first and captcha/OTP next, JSXC login succeeds right at the first phase and then shows on the second screen, which is undesirable. Did I get it right? I think we should open another issue for it, hopefully @sualko gives some insight.
OK to close this issue?
@dteleguin , thats right! i will open another issue explaining this.
To ilustrate why i included the "logoff" case, folow the printscreen on my first login today on webmail:
The plugin is working very well, but in some pages of roundcube the plugin was not load, for example in the pages:
Calendar and reading email.