Roundcube Community Forum

 

How login roundcube by php script?

Started by Metalik, September 02, 2012, 08:00:05 AM

Previous topic - Next topic

Metalik

Hello

How can login roubdcube by php script?

There is a script http://blog.philippheckel.com/2008/05/16/roundcube-login-via-php-script/ but it does not support host (imap server)
We need to set host (imap server) something similar to login($username, $password,$host)


w00t

#1
Same problem for me:

My members log in login.php and they'll redirect to a member area (Roundcube 0.8.1 is install on roundcube/)

I would like to use $_SESSION['username'] and $_SESSION['password'] created from my login.php in my roundcube installation to avoid a double authentication.

I tried to use autologon plugin with $rcmail_config['plugins'] = array('autologon');

I also found following link, but seems doesn't work for me :
http://lists.roundcube.net/pipermail/users/2012-March/008369.html

I think the solution is wanted by many people.

Thanks.

SKaero

You can't use the autologon plugin directly you'd need to modify it to fit your needs.

w00t

Ok, so autologon plugin is the right way to do what I need ?

$args['user'] = $_SESSION['username'];
$args['pass'] = $_SESSION['password'];


I'll very appreciate if you could help me to found the solution (I'm not a good php dev')  ;D

SKaero

Unfortunately its not so simple, in fact you'll need to come up with a different way of accessing the information because RoundCube doesn't use the same session as the rest of your site so you won't be able to access the stored information.

w00t

Ok, so if I use the same session_name on my php scripts ? I didn't found the Roundcube session_name in rcube_session.php
Can I also POST my session variables with ajax, but I don't know where POST it, and I think tokens can block me, no ?

SKaero

RoundCube uses a custom session handle so you can't easily tap into it. You could setup the autologin to accept posts so you could login that way.