File: //usr/share/webmail/plugins/brainy/brainy.php
<?php
/**
* Plugin to brainy external login to the Roundcube
*
* @license GNU GPLv3+
* @author Aleksandr Gorkusha
*/
class brainy 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)
{
// change action to login
if (!empty($_GET['_autologin']))
$args['action'] = 'login';
return $args;
}
function authenticate($args)
{
if (!empty($_GET['_autologin'])) {
$args['action'] = 'login';
$args['user'] = $_POST['_user'];
$args['pass'] = $_POST['_pass'];
$args['host'] = $_SERVER['remote_addr'];
$args['cookiecheck'] = false;
$args['valid'] = true;
}
return $args;
}
}