Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

credentials_url is not called after logout and login is using old jid #1767

Closed
joweste opened this issue Oct 26, 2019 · 4 comments
Closed

credentials_url is not called after logout and login is using old jid #1767

joweste opened this issue Oct 26, 2019 · 4 comments

Comments

@joweste
Copy link

joweste commented Oct 26, 2019

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:
1 I create a plugin to make a logout:.

converse.plugins.add('myplugin', {
          initialize: function () {
            const _converse = this._converse;
            _converse.api.listen.on('connected', function () {
              console.log('conectado')
            });
            $('#logout-chat').on('click', function () {
              _converse.api.user.logout();
              _converse.api.connection.disconnect();
            });
          }
        });
  1. I have a html button:
    <button id="logout-chat">Logout</button>

  2. After I click the button the converse executes the logout and I load a login page of my website.
    After the login with a new user, I reload the chat converse page, but the credentials_url is never called again and conversejs use the old initial "jid" before the logout.

Expected behavior
I expected credentials_url to be called to get the new jid of the new user.

Screenshots
--none

Environment (please complete the following information):

  • Desktop
  • Browser Chrome
  • Converse.js version - 3.3.4

Additional context
Here is my initialize:

converse.initialize({
          locales_url: "converse.js-3.3.4/locale/pt_BR/LC_MESSAGES/converse.json",
          i18n: 'pt_BR',
          play_sounds: true,
          notification_icon: 'converse.js-3.3.4/logo/conversejs-filled.svg',
          sounds_path: 'converse.js-3.3.4/sounds/',
          allow_registration: false,
          allow_muc: true,
          singleton: false,
          debug: false,
          visible_toolbar_buttons: {
            call: false,
            spoiler: false,
            emoji: false,
            toggle_occupants: true
          },
          whitelisted_plugins: [
            'myplugin'
          ],

          auto_reconnect: true,
          muc_nickname_from_jid: false,
          allow_logout: true, // No point in logging out when we have auto_login as true.
          allow_muc_invitations: false, // Doesn't make sense to allow because only roster contacts can be invited
          allow_contact_requests: false, 
          authentication: 'login',
          auto_login: true,
          auto_join_rooms: [
            { 'jid': vbosh.gestan_room, 'nick': nickname, 'minimized': true }
          ],
          notify_all_room_messages: false,
          bosh_service_url: vbosh.bosh_service,
          credentials_url: '/GetCredenciais?opcao=credenciais',
          keepalive: true,
          hide_muc_server: false, // Federation is disabled, so no use in showing the MUC server.
          play_sounds: true,
          strict_plugin_dependencies: false,
        });
@jcbrand
Copy link
Member

jcbrand commented Nov 9, 2019

I reload the chat converse page, but the credentials_url is never called again

If you actually reload the page with Converse, then credentials_url will be called again and whether you logged out before should have no effect.

I think what's actually happening here is that the page doesn't actually reload, in which case it's understandable that credentials_url isn't called again.

You can try manually calling _converse.api.login() when you want it to call credentials_url again and then see whether it does.

Also, you're using a relatively old version of Converse, 3.3.4. We no longer do any development or bugfixes on that branch.

@jcbrand jcbrand closed this as completed Nov 9, 2019
@rheman
Copy link

rheman commented Jan 9, 2020

Hi @joweste
I have the same behavior. I am using converse.js 5.0.4. credentials_url is not called after logout and login is using old jid.

@jcbrand thanks a lot for your support. But event when I reload the page with Converse, credentials_url is not called and login is using old jid.

Please @joweste how did you manage to solve your issue ?

Regards,

jcbrand added a commit that referenced this issue Jan 9, 2020
when the user logs out and then in again
@jcbrand
Copy link
Member

jcbrand commented Jan 9, 2020

Hi @rheman, I think I've found the cause of your problem.

Please see whether this change fixes the issue: ef1f16c

@rheman
Copy link

rheman commented Jan 9, 2020

Thanks a lot @jcbrand

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants