Roundcube Community Forum

 

Autologin fails in 0.7

Started by brandonsmith, June 13, 2012, 12:57:36 PM

Previous topic - Next topic

brandonsmith

ok ... that no longer errors, but it just takes me to the login screen and input the information (sans the password) into the form.

SKaero

Probably the password is wrong. If you replace:

str_replace('1800','',base64_decode(strrev(get_input_value('_pass', RCUBE_INPUT_POST, true, 'ISO-8859-1'))))

with the account password in clear text (ie "password") does it work?

brandonsmith

i changed it to:

function authenticate($args) {
  if (!empty($_POST['_autologin'])) {
    $args ['user']= $_POST['_user'];
    $args['pass']='<password>';
    $args['host']=$_POST['_host'];
    $args['cookiecheck']= false;
    $args['valid'] = true;
  }
  return $args;
}


that goes back to returning "your session is invalid or expired"

SKaero

There shouldn't be a space between $args and ['user'].

brandonsmith

there isn't .... miss copied. (i am doing this from a vm)

SKaero

Ok then add die('<pre>'. print_r($args, true)); before: return $args; and post whats returned after a login attempt.

brandonsmith

now reads:

function authenticate($args) {
  if (!empty($_POST['_autologin'])) {
    $args['user']= $_POST['_user'];
    $args['pass']='<password>';
    $args['host']=$_POST['_host'];
    $args['cookiecheck']= false;
    $args['valid'] = true;
  }
  die ('<pre>'. print_r($args, true));
  return $args;
}


That take me back to the login screen with error: "Your session is invalid or expired."

as a side note ... i also tried in the die field die('<pre>'.implode(",",$args)); and die ('<pre>'; print_r($args,true)); I was unsure if php accepted a print_r after a '.'

SKaero

Hmm it doesn't look like its getting to the authenticate function, try changing the form action to point to http://10.145.66.139/roundcube/?_task=login

brandonsmith

that bring me back to login page with everything but the password filled in. No errors. No dump from the die line.

SKaero

Hmm maybe its doing a ajax post at that point for some reason, its hard to guess without being able to see/test it. Is there anyway I could get test access to it?

brandonsmith

Unfortunately no. It is internal only. Does it make any difference that it is most current release of roundcube. Or that the install was done with aptitude? Is there anyway to know that the plugin is working (I have the plugin added to the config file)?

SKaero

Shame, it shouldn't make a difference that it was installed aptitude and the code should work with any version of the 0.7.x series. You could try this code to see if the plugin is working in its most basic form:

<?php
class autologon 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();

    
// change action to login
    
if (empty($_SESSION['user_id']))
      
$args['action'] = 'login';

    return 
$args;
  }

  function 
authenticate($args)
  {
    
$args['user'] = '<username>';
    
$args['pass'] = '<password>';
    
$args['host'] = '<host>';
    
$args['cookiecheck'] = false;
    
$args['valid'] = true;
  
    return 
$args;
  }

}

That should automatically log you into RoundCube when you go directly to it.

brandonsmith

no joy.

That just runs me to the login screen with the username and host pre-filled out ... No error however.

But with that information pre-filled in, if i just add my password, it does login.

brandonsmith

after some additional testing ... i am finding that none of the plugins I am adding seem to work. I tired a rather easy one with "html5_notifier" with a chrome browser and got no notification that the plugin was working or trying to work.

The line in the main.inc.php.dist file for plugins reads:
$rcmail_config['plugins'] = array('autologin','html5_notifier');

the plugins directory contains:
autologin , filesystem_attachments, html5_notifier , jqueryui

is there something i am missing?

ASeques

I am experiencing exactly the same issue as you, and followed all the steps here, unfortunately there's no solution. Still, the rest of the plugins work fine for me (fail2ban, google_ads, and others)

The strange thing is that I can see in the errors file for every time i try the autologon this:
[27-Jun-2012 11:11:34 +0200]: PHP Error: No handler found for action plugin.wrapper in /var/www/webmail.example.com/program/include/rcube_plugin_api.php on line 300 (GET /?_task=mail&_default_width=1000&_screen_width=806&_action=plugin.wrapper)