Roundcube Community Forum
Third Party Contributions => API Based Plugins => Topic started by: henkjanklok on February 20, 2012, 06:11:41 AM
-
Hello,
I'm using RC 0.7 but i will a login script in PHP. I'm using the following code but it doesn't work:
Form:
And i have activate the auto_logon script in the main.inc, and this is the code of the autologon.php
:
class autologon extends rcube_plugin
{
public $task = 'login';
function init()
{
$this->add_hook('startup', array($this, 'startup'));
$this->add_hook('authenticate', array($this, 'authenticate'));
}
function startup($args)
{
$rcmail = rcmail::get_instance();
if (empty($_SESSION['user_id']) && !empty($_GET['_autologin']))
$args['action'] = 'login';
return $args;
}
function authenticate($args)
{
if (!empty($_GET['_autologin'])) {
$args['user'] = $_GET['user'];
$args['pass'] = $_GET['pass'];
$args['valid'] = true;
$args['cookiecheck'] = false;
}
return $args;
}
}
The page give the following result: "Invalid request! No data was saved.".
-
In the auto login plugin you need need to switch all of the $_GET to $_POST since your posting the data.
-
It doesn't work, the error is the same.
-
Do you have succes to work this plug in i have the same error ?
-
You need to do something with _autologin. You're checking if it exists in $_GET, but then you have to use it in your URL or POST it.
So you could http://www.mywebsite.nl/webmail/index.php?_autologin=1 or add a hidden POST var called _autologin
-
I finally made that. Check it out in my gist. https://gist.github.com/TeeBSD/8610622
Just make a patch.
PS: I need a job.