How to use autologon plugin of Roundcube
Roundcube bundles a plugin example for autologon. But not much documentation about how to use/implement it.
After few tests, here is the note for sharing
Step 1. To enable the autologon, include the 'autologon' in config file
# vi ...rcpath.../config/config.inc.php
$config['plugins'] = array('vacation','autologon');
Step 2. Add the login data to plugin
# vi ...rcpath.../plugins/autologon/autologon.php
* find the function
function authenticate($args)
{
if (!empty($_GET['_autologin']) && $this->is_localhost()) {
$args['user'] = 'username';
$args['pass'] = 'password';
$args['host'] = 'host';
Step 3. To use the autologon with following URL
http://yourserver/roundcube?_autologin=1
It should works
To go further if you don't want to hard code the login information in php and want the login data being passed by GET/POST, modify the Step2 as following
# vi ...rcpath.../plugins/autologon/autologon.php
* find the function
function authenticate($args)
{
if (!empty($_GET['_autologin']) && $this->is_localhost()) {
$args['user'] = $_POST["rcuser"];
$args['pass'] = $_POST["rcpass"];
$args['host'] = $_POST["rchost"];
if ($args['user'] == '') {
$args['user'] = $_GET["rcuser"];
}
if ($args['pass'] == '') {
$args['pass'] = $_GET["rcpass"];
}
if ($args['host'] == '') {
$args['host'] = $_GET["rchost"];
}
With this you can now pass your login data with following URL (Get Method)
http://yourserver/roundcube?_autologin=1&rcuser=xxxxx&rcpass=xxxxx&rchost=xxxxx
But get is not safe while password exposed in URL, the script also support Post Method.
For Post Method, use the following script
or you can test it with following full html file
3 comments:
Hello, I did exactly as you indicated, but get error: Login Failed when redirected to roundcube login page
It doesnt work anymore, do you happen to have any update in this codes? (password is not being prefilled)
Post a Comment