priyadi / roundcube-converse.js-xmpp-plugin

XMPP plugin for Roundcube Webmail based on converse.js
48 stars 18 forks source link

parsing username and password to main url of roundcube and refreshing the main page #18

Closed masterxq closed 10 years ago

masterxq commented 10 years ago

Hello, we are just trying to get converse work with roundcube usings slightly changed standard config.

When submitting the user data the page refreshes, and the username and password appear in the address bar. Additionally, the user is not logged in to xmpp and is shown the login screen again. BOSH is probably working, tested it with jappix and jwchat.

I hope we did not make a silly mistake.

Best regards

MasterQ and Mo

Our config:

<?php // important variables in the following anonymous functions: // $args['host'] : IMAP hostname // $args['user'] : IMAP username // $args['pass'] : IMAP password

// Hostname of BOSH endpoint, used for prebinding only (called by PHP), // this must be an absolute URL $rcmail_config['converse_xmpp_bosh_prebind_url']= function($args) { return 'http://localhost:5280/http-bind/';

return sprintf('http://%s/http-bind', $_SERVER['HTTP_HOST']);

    # return sprintf('http://%s/http-bind', $args['host']);

};

// Hostname of BOSH endpoint, used by web browsers (called by Javascript code), // this can be a relative URL $rcmail_config['converse_xmpp_bosh_url']= function($args) { return '/http-bind/'; };

// Hostname portion of XMPP username (bare JID), example: "example.net" $rcmail_config['converse_xmpp_hostname']= function($args) { return 'specialchat.de';

return preg_replace('/^.*@/', '', $args['user']);

    # return $args['host'];

};

// Username portion of XMPP username (bare JID), example: "user" // if this contains @, this will only take the part before @, // and the part after @ will replace the hostname definition above. $rcmail_config['converse_xmpp_username']= function($args) { return split('@', $_SESSION['username'])[0].'@specialchat.de';

return $args['user'];

# return preg_replace('/@.*$/', '', $args['user']);

};

// XMPP password $rcmail_config['converse_xmpp_password']= function($args) { return '$_SESSION['password']; //Will be decoded later... so that is not the problem

return $args['pass'];

};

// Always embed chat even if prebinding is not configured or failed $rcmail_config['converse_xmpp_enable_always'] = true;

// Enable debug mode $rcmail_config['converse_xmpp_debug'] = false;

// Enable development mode $rcmail_config['converse_xmpp_devel_mode'] = false;

// Use older XMPP bind code (in case someone is having problem with // newer code using Candy Chat's prebind library) $rcmail_config['converse_xmpp_old_style_prebind'] = false;

// Configure XMPP resource prefix. XMPP resource is set to this variable // appended with a unique id. Defaults to 'Roundcube-'. $rcmail_config['converse_xmpp_resource_prefix'] = 'Roundcube';

thomascube commented 10 years ago

The form submission is definitely a bug in converse.js and needs to be investigated.

return '$_SESSION['password']; has a syntax error and doesn't work anyway. Use the default $args['pass'].

Enable debug mode and connect with FirePHP to trace the pre-binding process and to find out where it fails.

masterxq commented 10 years ago

Thanks for the fast answer. The ' is a syntax error, i made after coping the config file. I slightly changed it for security reasons. Sry! Why is this: return '$_SESSION['password']; not working? I decode the session password in my jabber auth script. The goal is: prevent my users from cleartext password everywhere and use autologin for xmpp. Or is it just not working because i misunderstood the config?

FirePHP is neither showing warning nor errors, it's not even showing debug information. I'm not sure if i use it correctly, but debug mode is enabled now and firePHP's console too. I never used it before...

I'm using return $args['pass'] now... But it's not helping :(

Regards

MasterQ

masterxq commented 10 years ago

Ok, i got it work, but never found the problem. But found a new Problem. I'm not sure this is the right place to report/ask.. I will open a new issue report.

Regards MasterQ

thomascube commented 10 years ago

FWIW: the username and password appearing in the browser's URL was due to missing bosh_service_url property in the converse.js init options when pre-binding failed. Although the chat login form was available, its data was not processed by converse but the form just got submitted (using GET!). Commit a340064c should fix this and enable pure client-side initiated XMPP sessions.