Roundcube Community Forum

Third Party Contributions => API Based Plugins => Topic started by: lacri on June 16, 2009, 03:58:45 AM

Title: RC plugin autologin from CMS or Portal ...
Post by: lacri on June 16, 2009, 03:58:45 AM
I have realisized based on the autologon sample plugin an plugin thats make login from a portal or other external site or cms into roundcube possible.

i attached the plugin with a little guide inside.

Tested with current SVN 2646

Change
attachment replace with new version for little bit more security
the pass is no more submittet as plaintext
Title: 124
Post by: qrst570 on June 16, 2009, 06:21:07 PM
¿Õѹ»ú±äƵ¸ÄÔìºóµÄЧÒæ --- ¿Õѹ»úÓÍ 's BLOG (http://www.lkren.com/html/blog/76/767.htm)¶þÑõ»¯Ì¼Ñ¹Ëõ»úÔÚÔËÐйý³ÌÖÐ --- ¿Õѹ»úÓÍ 's BLOG (http://www.gaomi169.com/html/blog/1403/10175.htm)¿ÕÆøѹËõ»ú±äƵµ÷ËÙ¿ØÖÆ·½Ê½µÄ°²×°µ÷ÊÔ --- ¿Õѹ»úÓÍ 's BLOG (http://www.gaomi169.com/html/blog/1403/10176.htm)¶þÑõ»¯Ì¼Ñ¹Ëõ»úÔÚÔËÐйý³ÌÖÐ --- ¿Õѹ»úÓÍ 's BLOG (http://www.zwinfo.com/html/blog/318/1206.htm)¿Õѹ»úÈȱÃ×ÛºÏÓŵã --- ¿Õѹ»úÓÍ 's BLOG (http://www.i8818.com/html/blog/1564/5225.htm)
Title: RC plugin autologin from CMS or Portal ...
Post by: mst3kroqs on August 29, 2009, 06:57:30 PM
Shouldn't:

Code: [Select]
    // 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'))));


be:

Code: [Select]
    // decode pass, revert and replace key
   $args['_pass'] = str_replace('*yourkey*','',base64_decode(strrev(get_input_value('_pass', RCUBE_INPUT_POST, true, 'ISO-8859-1'))));


??
Title: RC plugin autologin from CMS or Portal ...
Post by: CarlB on November 26, 2009, 12:28:05 PM
Very nice!

Is there any way to use this to open a new message with the to: pre filled?

Thank you.
Title: RC plugin autologin from CMS or Portal ...
Post by: komunikasys on December 24, 2009, 12:23:59 AM
Could someone tell me how to remove logout button once the user login from other cms, and instead of using logout button on roundcube, i would like to use logout button from my cms. So what script do i have to add on my logout acction?

Best regards

Raymond Victorio
Title: RC plugin autologin from CMS or Portal ...
Post by: flattery on April 15, 2010, 11:43:03 AM
One quick and dirty way to do it is to edit the skin file.
/skins/default/includes/taskbar.html


Quote from: komunikasys;24205
Could someone tell me how to remove logout button once the user login from other cms, and instead of using logout button on roundcube, i would like to use logout button from my cms. So what script do i have to add on my logout acction?

Best regards

Raymond Victorio
Title: RC plugin autologin from CMS or Portal ...
Post by: cftt on May 06, 2010, 04:28:01 AM
don't seem to work en 0.4 beta!

Any workaround?
Title: RC plugin autologin from CMS or Portal ...
Post by: TTrek on May 18, 2010, 10:57:42 AM
Hi,
did you find a fix?
Title: RC plugin autologin from CMS or Portal ...
Post by: loproc on August 30, 2010, 10:59:49 AM
Quote from: cftt;27283
don't seem to work en 0.4 beta!

Any workaround?


Yup, in the following:
    // change action to login
    if ($args['task'] == 'mail' && empty($args['action']) && empty($_SESSION['user_id']) && !empty($autologin)) {
      $args['action'] = 'login';


change "mail" to "login" so you have the following:
    // change action to login
    if ($args['task'] == 'login' && empty($args['action']) && empty($_SESSION['user_id']) && !empty($autologin)) {
      $args['action'] = 'login';
Title: RC plugin autologin from CMS or Portal ...
Post by: darkfly on October 02, 2010, 09:17:43 PM
I have instaled the autologin plugin for test,and i can't put it working!

I go to the roundcube login page but with error "bad username or password".

I know the value are working, because in the login form, the email address is good, so i think is a password problem.

I use this code:

$userpassword = "testpassword";

$_SESSION['userpassword'] = strrev(base64_encode('ot-%IrA3e+=3$Oug7yheBi%k'.$userpassword));

echo '







';


in autologin.php i have:
// decode pass, revert and replace key
         $_POST['_pass'] = str_replace('ot-%IrA3e+=3$Oug7yheBi%k','',base64_decode(strrev(get_input_value('_pass', RCUBE_INPUT_POST, true, 'ISO-8859-1'))));


i have the same key in the 2files.

i have try with:

same problem


What s wrong? any idea? Thanks
Title: RC plugin autologin from CMS or Portal ...
Post by: stewx on October 14, 2010, 08:22:53 AM
Has anyone actually gotten this plugin to work?  I've been trying in vain for a day or so...
Title: RC plugin autologin from CMS or Portal ...
Post by: timtraver on November 22, 2010, 03:36:40 AM
Quote from: stewx;30727
Has anyone actually gotten this plugin to work?  I've been trying in vain for a day or so...

yes, it works like it says it does. what is the problem that you are having?

The real thing that I am running into is if you don't logout of the webmail client, and you try and do the autologin from the CMS to another account, the session isn't killed and it goes to the previous account.

Anyone know how to kill the session before it tries to do the autologin? I've tried a bunch of ways of killing the session cookie, and killing the session in the autologin code, but to no avail...

Tim
Title: RC plugin autologin from CMS or Portal ...
Post by: mikelsoft on December 16, 2010, 10:44:35 PM
using 0.5 beta

i still fail to use the plugin

here are my config

if ($args['task'] == 'login' && empty($args['action']) && empty($_SESSION['user_id']) && !empty($autologin)) {
      $args['action'] = 'login';

      // decode pass, revert and replace key
                  $args['_pass'] = str_replace('mykey','',base64_decode(strrev(get_input_value('_pass', RCUBE_INPUT_POST, true, 'ISO-8859-1'))));

the form
$password='pa33word';

$_SESSION['userpassword'] = strrev(base64_encode('mykey'.$password));


echo '







Submit
';

give me login error help please anyone
Title: RC plugin autologin from CMS or Portal ...
Post by: CarlB on January 31, 2011, 02:26:09 PM
Is it possible to use this with 0.5 ?
Title: RC plugin autologin from CMS or Portal ...
Post by: Muaythaitv on February 26, 2011, 03:55:06 PM
Quote from: CarlB;32867
Is it possible to use this with 0.5 ?

Look here : autologon.php in trunk/plugins/autologon ? Roundcube Webmail (http://trac.roundcube.net/browser/trunk/plugins/autologon/autologon.php)

At minimum it miss
$args['cookiecheck'] = false;
$args['valid'] = true;
in function authenticate
Title: RC plugin autologin from CMS or Portal ...
Post by: talvins on February 27, 2011, 02:19:03 PM
Doesn't work for me: "Invalid request! No data was saved."

Using :
     
     
     
      ">
      ">
     

with $mailpass = strrev(base64_encode('my_key'.$good_password)
Title: RC plugin autologin from CMS or Portal ...
Post by: rosali on February 27, 2011, 11:29:06 PM
It does not work since v0.5.1 due to CSFR protection of the login request.

Check my logout_redirect plugin and adust the outside login form as shown in the folder ajax_login.
Title: RC plugin autologin from CMS or Portal ...
Post by: talvins on March 04, 2011, 09:38:22 AM
Doesn't work : authentication failed. I tried directly with your entire plugin, using ajax_login.php as login interface.

Could you explain what has changed in the authentication process? hash/hash+salt and same in DB ? symetric encryption ?

Thanks.
Title: RC plugin autologin from CMS or Portal ...
Post by: rosali on March 04, 2011, 10:59:53 AM
There is a small bug in the plugin, which will be fixed in next release.

It should work if you adjust the action url in ajax_login.php and if
the referer url in the config file is properly defined.

The change was that login needs a Roundcube generated token in
the login form. If you login from outside, you can't have the token.
The token is stored in the (Roundcube) session. The workaround is
to have a plugin which sets the return argument 'valid' to true
on authenticate hook. If you have a little bit PHP skills, just look
into the authenticate hook of the plugin and you'll see what to do.
Title: RC plugin autologin from CMS or Portal ...
Post by: talvins on March 04, 2011, 11:44:32 AM
In fact, after tracing, I have a problem with your authenticate function.

$args['valid'] is true only if
        $rcmail->config->get('logout_redirect_referer', false) &&
        stristr($_SERVER['HTTP_REFERER'],$rcmail->config->get('logout_redirect_referer'))

But it's false in my conf, so $args['valid'] is never true.
Title: RC plugin autologin from CMS or Portal ...
Post by: talvins on March 04, 2011, 12:24:06 PM
Why your fonction doesn't work with GET datas ? Even if I change _POST with _REQUEST.
Title: RC plugin autologin from CMS or Portal ...
Post by: rosali on March 04, 2011, 01:34:07 PM
Make your own plugin for your needs. Just use the authenticate hook ...

It is quite easy:
Code: [Select]

class external_login extends rcube_plugin
{
  public $task = 'login|logout';
 
  function init()
  {
    $this->add_hook('authenticate', array($this, 'authenticate'));
  }

  function authenticate($args)
  {
    // validate request if desired and however you want to do it
    // if validation is passed, then return true ...
    $args['valid'] = true;
    return $args;
  }
}
Title: RC plugin autologin from CMS or Portal ...
Post by: talvins on March 05, 2011, 12:26:49 PM
Ok, I'll look for that.

thanks a lot.
Title: RC plugin autologin from CMS or Portal ...
Post by: dorsig on August 26, 2011, 05:39:55 AM
change the class like this should work:

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'] == 'login' && empty($args['action']) && empty($_SESSION['user_id']) && !empty($autologin)) {
      $args['action'] = 'login';

      // decode pass, revert and replace key
           $_POST['_pass'] = str_replace('*yourpass*','',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);
      $args['cookiecheck'] = false;
      $args['valid'] = true;
    }
    return $args;
  }
}
Title: problems with autologin
Post by: belyitigr@gmail.com on September 08, 2011, 01:39:26 PM
Hi!

I have roundmail-0.6Rc and try use this script for autologin. But alwasys have errror...'Your session is invalid or expired.'
Maybe somebody know how resolve this? My param..

$_SESSION['userpassword'] = strrev(base64_encode('3108'.'111'));

echo '







Submit
';


and class code

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'] == 'login' && empty($args['action']) && empty($_SESSION['user_id']) && !empty($autologin)) {
      $args['action'] = 'login';

      // decode pass, revert and replace key
           $_POST['_pass'] = str_replace('3108','',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);
      $args['cookiecheck'] = false;
      $args['valid'] = true;
    }
    return $args;
  }
}
Title: RC plugin autologin from CMS or Portal ...
Post by: andrusha777 on September 14, 2011, 07:43:57 AM
Hi! The code change in plugin from dorsig posted above has fixed autologin plugin. It was working for me along time, but after updated to 0.5.4 from 0.5 beta - autologin was broken. Changing the code has fixed this problem. Don't know about 0.6 and above...
Title: create a blog" if possible
Post by: createafreeblog on September 15, 2011, 01:33:31 AM
Create a free blog


Create Free Blog | Free Blog WP WordPress (http://1bl.co/)


Use this website
Title: RC plugin autologin from CMS or Portal ...
Post by: apeitup on September 23, 2011, 12:56:49 PM
Does this plugin work on v0.54. Only I desperately need to get this running.
Title: RC plugin autologin from CMS or Portal ...
Post by: tlq123 on September 26, 2011, 02:52:27 AM
Thanks for the information,just found this post my technorati news feed section! I was searching for this since past 3 months and i am glad to see it here. Thanking you much