Roundcube Community Forum

Third Party Contributions => API Based Plugins => Topic started by: henkjanklok on February 20, 2012, 06:11:41 AM

Title: External login php script
Post by: henkjanklok on February 20, 2012, 06:11:41 AM
Hello,

I'm using RC 0.7 but i will a login script in PHP. I'm using the following code but it doesn't work:

Form:


   
   
   
   
       
    User

    Pass

       
   



And i have activate the auto_logon script in the main.inc, and this is the code of the autologon.php
:
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();

    if (empty($_SESSION['user_id']) && !empty($_GET['_autologin']))
      $args['action'] = 'login';

    return $args;
  }

  function authenticate($args)
  {
    if (!empty($_GET['_autologin'])) {
      $args['user'] = $_GET['user'];
      $args['pass'] = $_GET['pass'];
      $args['valid'] = true;
      $args['cookiecheck'] = false;
    }

    return $args;
  }
}

The page give the following result: "Invalid request! No data was saved.".
Title: External login php script
Post by: SKaero on February 20, 2012, 11:22:52 AM
In the auto login plugin you need need to switch all of the $_GET to $_POST since your posting the data.
Title: External login php script
Post by: henkjanklok on February 27, 2012, 07:56:27 AM
It doesn't work, the error is the same.
Title: Re: External login php script
Post by: logone on April 03, 2012, 05:05:04 PM
Do you have succes to work this plug in i have the same error ?
Title: Re: External login php script
Post by: corbosman on April 26, 2012, 03:36:31 AM
You need to do something with _autologin. You're checking if it exists in $_GET, but then you have to use it in your URL or POST it.

So you could http://www.mywebsite.nl/webmail/index.php?_autologin=1 or add a hidden POST var called _autologin

Title: Re: External login php script
Post by: teebsd on January 24, 2014, 09:05:57 PM
I finally made that. Check it out in my gist. https://gist.github.com/TeeBSD/8610622

Just make a patch.

PS: I need a job.