Author Topic: Autologin fails in 0.7  (Read 21175 times)

Offline brandonsmith

  • Jr. Member
  • **
  • Posts: 18
Re: Autologin fails in 0.7
« Reply #15 on: June 15, 2012, 05:41:06 PM »
ok ... that no longer errors, but it just takes me to the login screen and input the information (sans the password) into the form.

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,879
    • SKaero - Custom Roundcube development
Re: Autologin fails in 0.7
« Reply #16 on: June 15, 2012, 06:03:59 PM »
Probably the password is wrong. If you replace:
Code: [Select]
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?

Offline brandonsmith

  • Jr. Member
  • **
  • Posts: 18
Re: Autologin fails in 0.7
« Reply #17 on: June 15, 2012, 06:09:27 PM »
i changed it to:
Code: [Select]
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"

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,879
    • SKaero - Custom Roundcube development
Re: Autologin fails in 0.7
« Reply #18 on: June 15, 2012, 06:12:58 PM »
There shouldn't be a space between $args and ['user'].

Offline brandonsmith

  • Jr. Member
  • **
  • Posts: 18
Re: Autologin fails in 0.7
« Reply #19 on: June 15, 2012, 06:17:05 PM »
there isn't .... miss copied. (i am doing this from a vm)

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,879
    • SKaero - Custom Roundcube development
Re: Autologin fails in 0.7
« Reply #20 on: June 15, 2012, 06:20:00 PM »
Ok then add
Code: [Select]
die('<pre>'. print_r($args, true)); before:
Code: [Select]
return $args; and post whats returned after a login attempt.

Offline brandonsmith

  • Jr. Member
  • **
  • Posts: 18
Re: Autologin fails in 0.7
« Reply #21 on: June 15, 2012, 06:27:58 PM »
now reads:
Code: [Select]
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
Code: [Select]
die('<pre>'.implode(",",$args)); and
Code: [Select]
die ('<pre>'; print_r($args,true)); I was unsure if php accepted a print_r after a '.'

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,879
    • SKaero - Custom Roundcube development
Re: Autologin fails in 0.7
« Reply #22 on: June 15, 2012, 06:40:44 PM »
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

Offline brandonsmith

  • Jr. Member
  • **
  • Posts: 18
Re: Autologin fails in 0.7
« Reply #23 on: June 15, 2012, 06:47:36 PM »
that bring me back to login page with everything but the password filled in. No errors. No dump from the die line.

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,879
    • SKaero - Custom Roundcube development
Re: Autologin fails in 0.7
« Reply #24 on: June 15, 2012, 07:40:42 PM »
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?

Offline brandonsmith

  • Jr. Member
  • **
  • Posts: 18
Re: Autologin fails in 0.7
« Reply #25 on: June 15, 2012, 08:41:55 PM »
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)?

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,879
    • SKaero - Custom Roundcube development
Re: Autologin fails in 0.7
« Reply #26 on: June 16, 2012, 04:56:39 PM »
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:
Code: [Select]
<?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.

Offline brandonsmith

  • Jr. Member
  • **
  • Posts: 18
Re: Autologin fails in 0.7
« Reply #27 on: June 18, 2012, 01:48:07 PM »
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.

Offline brandonsmith

  • Jr. Member
  • **
  • Posts: 18
Re: Autologin fails in 0.7
« Reply #28 on: June 18, 2012, 05:05:29 PM »
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?

Offline ASeques

  • Jr. Member
  • **
  • Posts: 12
Re: Autologin fails in 0.7
« Reply #29 on: June 27, 2012, 05:17:36 AM »
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:
Code: [Select]
[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)