I want to autenticate my own users to their webmail account. It works with form and plugin below - it's a clone of in Roundcube included autologon plugin. But when I close the browser's window or tab and send immediately this form again, the window with roundcubemail is opened, the user seems to be authenticated, but none messages are shown and error message occurs: 'Invalid request! No data was saved.'.
Why? What I'm doing bad? Do you see something wrong in the plugin or in the form?
Best regards
Tomas
<form id="webmail-form" action="
https://ouweb/index.php" method="post" target="webmail">
<input type="hidden" value="1" name="_autologin">
<input type="hidden" value="" name="user">
<input type="hidden" value="" name="pass">
</form>
class our_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($_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;
}
}