Hi,
I found also this :
/roundcube/config/main.inc.php
$rcmail_config['plugins'] = array('autologon');
/roundcube/plugins/autologon/autologon.php
<?php
/**
* Sample plugin to try out some hooks.
* This performs an automatic login if accessed from localhost
*/
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();
// change action to login
if (empty($_SESSION['user_id']) && !empty($_POST['_autologin']))
$args['action'] = 'login';
return $args;
}
function authenticate($args)
{
if (!empty($_POST['_autologin'])) {
$args['user'] = $_POST['_user'];
$args['pass'] = $_POST['_pass'];
$args['cookiecheck'] = false;
$args['valid'] = true;
}
return $args;
}
}
HTML:
<form name="form" action="roundcube/index.php" method="post">
<input type="hidden" name="_action" value="login" />
<input type="hidden" name="_task" value="login" />
<input type="hidden" name="_autologin" value="1" />
<table border="0">
<tr>
<td>username:</td>
<td>
<input name="_user" id="rcmloginuser" size="28" type="text" /></td>
</tr>
<tr>
<td>Password:</td>
<td>
<input name="_pass" id="rcmloginpwd" size="28" type="password"/></td>
</tr>
<tr>
<td>
<input class="Button" type="submit" size="28" value="Webmail Login"/></td>
</tr>
</table>
</form>
>----Messaggio originale----
>Da: [email protected]
>Data: 07/03/2012 15.38
>A: <[email protected]>
>Ogg: [RCU] R: R: autologin from other php page
>
>Hi,
>
> the plugin "autologin" with version 0.7.1 doesn't work !!! The logical
it's
>all different !!
>
>I made a little script in php to make autologin and it works :
>
><?
>require_once 'program/include/iniset.php';
>$RCMAIL = rcmail::get_instance();
>$auth= $RCMAIL->get_request_token();
>?>
>
><form method="post" action="index.php" name="form">
><input type="hidden" value="<?php echo $auth ?>" name="_token">
><input type="hidden" value="login" name="_action">
><input id="timezone" type="hidden" value="_default_" name="_timezone">
><input id="url" type="hidden" name="_url">
><input id="domain" type="hidden" value="xxxxxx.xx" name="_domainname">
><input id="redirectdomain" type="hidden" value="xxxxxx.xx" name="
>_redirect_domain">
>
><input id="loginuser" type="text" value="" name="_user">
><input id="loginpwd" type="password" value="" name="_pass">
><input type="submit" value="SUBMIT">
></form>
>
>
>
>>----Messaggio originale----
>>Da: [email protected]
>>Data: 06/03/2012 18.21
>>A: <[email protected]>
>>Ogg: [RCU] R: autologin from other php page
>>
>>Hi,
>>
>>in my previous email I was wrong to write : the autologin plugin does NOT
>>work !!!
>>
>>Thank you
>>Mark
>>
>>
>>
>>>----Messaggio originale----
>>>Da: [email protected]
>>>Data: 06/03/2012 17.01
>>>A: <[email protected]>
>>>Ogg: [RCU] autologin from other php page
>>>
>>>Hi All,
>>>
>>> it's me again :-) !!!!!!!
>>>
>>>I would use roundcube with autologin from another php script. I found the
>>>plugin "autologin" but it seems to work.
>>>This is my php script :
>>>
>>><!DOCTYPE html>
>>><html>
>>><head>
>>></head>
>>><body>
>>><?
>>>$_POST['password'] = 'password in clear and in plain text';
>>>$_SESSION['userpassword'] = strrev(base64_encode('*yourkey*'.$_POST
>>>['password']));
>>>?>
>>><form name="roundcubelogin" action="http://192.168.254.201/roundcube/?
>>>_task=mail" method="post" target="roundcube">
>>><input type="hidden" name="_timezone" value="_default_" />
>>><input type="hidden" name="_task" value="mail" />
>>><input type="hidden" name="_autologin" value="1" />
>>><input type="hidden" name="_user" value="mark" />
>>><input type="hidden" name="_host" value="192.168.254.201:143" />
>>><input type="hidden" name="_pass" value="<?echo $_SESSION['userpassword']?
>>"
>>>/>
>>><input type="submit" name="submit" value="SUBMIT" />
>>></form>
>>></body>
>>></html>
>>>
>>>The plugin autologin.php :
>>>
>>><?php
>>>
>>>/**
>>> * This plugin performs an automatic login if accessed
>>> * with post Data from other Site an Portal or CMS
>>> * Based on sample autologon PlugIn
>>> *
>>> * @version 0.2
>>> * @author Eric Appelt (lacri)
>>> *
>>> * show into README to install and config
>>> *
>>> * changes
>>> * 0.2 make a little bit secure with base64_encode strrev
>>> * and a key thats replace after submitting encoded pass data
>>> *
>>> */
>>>
>>>class autologin extends rcube_plugin
>>>{
>>>
>>> function init()
>>> {
>>> $this->add_hook('startup', array($this, 'startup'));
>>> $this->add_hook('authenticate', array($this, 'authenticate'));
>>> }
>>>
>>> function startup($args)
>>> {
>>> $rcmail = rcmail::get_instance();
>>>
>>> $autologin = get_input_value('_autologin', RCUBE_INPUT_POST);
>>>
>>> // change action to login
>>> if ($args['task'] == 'mail' && empty($args['action']) && empty
($_SESSION
>>>['user_id']) && !empty($autologin)) {
>>> $args['action'] = 'login';
>>>
>>> // decode pass, revert and replace key
>>> $_POST['_pass'] =
>>> str_replace('*yourkey*','',base64_decode(strrev
>>>(get_input_value('_pass', RCUBE_INPUT_POST, true, 'ISO-8859-1'))));
>>>
>>> // set initial cookie without this cookie login is not possible
>>> $_COOKIE['roundcube_sessid'] = session_id();
>>> }
>>> return $args;
>>> }
>>>
>>> function authenticate($args)
>>> {
>>> $autologin = get_input_value('_autologin', RCUBE_INPUT_POST);
>>>
>>> if (!empty($autologin)) {
>>> $args['user'] = get_input_value('_user', RCUBE_INPUT_POST);
>>> $args['pass'] = get_input_value('_pass', RCUBE_INPUT_POST);
>>> $args['host'] = get_input_value('_host', RCUBE_INPUT_POST);
>>> }
>>> return $args;
>>> }
>>>}
>>>_______________________________________________
>>>Roundcube Users mailing list
>>>[email protected]
>>>http://lists.roundcube.net/mailman/listinfo/users
>>>
>>
>>
>>_______________________________________________
>>Roundcube Users mailing list
>>[email protected]
>>http://lists.roundcube.net/mailman/listinfo/users
>>
>
>
>_______________________________________________
>Roundcube Users mailing list
>[email protected]
>http://lists.roundcube.net/mailman/listinfo/users
>
_______________________________________________
Roundcube Users mailing list
[email protected]
http://lists.roundcube.net/mailman/listinfo/users