Roundcube Community Forum

 

Autologon Plugin

Started by Pache, July 18, 2011, 04:18:34 PM

Previous topic - Next topic

Pache

Hi guys, im testing this application.

We want to publish in an iframe, in our intranet, a shared Google Apps mail account.

We need the autologin enabled, in fact, if i write http://localhost/mails in my navigator i should be logged in automatically

But, when i go to that URL, i must put my user name and password. What am i doing wrong?

I have installed WAMP in my laptop.

These are my configs:


main.inc.php

// ----------------------------------
// PLUGINS
// ----------------------------------

// List of active plugins (in plugins/ directory)
$rcmail_config['plugins'] = array('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'] = '[email protected]';
     
$args['pass'] = 'AccountPassword';
   }
 
   return
$args;
 }

}



Thanks in advance!!

SKaero

In the authenticate function you need to add the following lines:
Quote$args['cookiecheck'] = false;
$args['valid'] = true;