Author Topic: logging in from another page php  (Read 4563 times)

Offline bcr666

  • Newbie
  • *
  • Posts: 4
logging in from another page php
« on: June 24, 2012, 10:54:18 PM »
Our users log in to our site, and I don't want them to have to log in a second time when they want to bring up their mail. Is there a way to login and bypass the index.php?

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,882
    • SKaero - Custom Roundcube development
Re: logging in from another page php
« Reply #1 on: June 25, 2012, 05:21:25 PM »
You should be able to modify the autologin plugin to do what you want http://trac.roundcube.net/browser/github/plugins/autologon/autologon.php

Offline bcr666

  • Newbie
  • *
  • Posts: 4
Re: logging in from another page php
« Reply #2 on: June 25, 2012, 10:04:08 PM »
I don't understand how autologin gets called or how to pass parameters to it.

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,882
    • SKaero - Custom Roundcube development
Re: logging in from another page php
« Reply #3 on: June 26, 2012, 02:28:02 PM »
Normally it would get data statically or from a post, you may want to configure it to pull information out of a database.

Offline bcr666

  • Newbie
  • *
  • Posts: 4
Re: logging in from another page php
« Reply #4 on: June 28, 2012, 12:53:14 AM »
OK, I've figured out how to turn on the AUTOLOGON plugin, and how to hard code the username password and host. The problem is that I need to either pass that information in, or look it up in a database (if I look it up in the database, I need a user_id). I am currently trying the database method, but the only things in my $_SESSION are:


[27-Jun-2012 22:47:56 -0600]: Array
(
    [language] => en_US
    [temp] => 1
)

How can I pass in the required information.

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,882
    • SKaero - Custom Roundcube development
Re: logging in from another page php
« Reply #5 on: June 28, 2012, 01:16:14 AM »
RoundCube uses it own session management so you wont be able to access data directly via the session. You can pass it as get parameter in the url or in a cookie.

Offline bcr666

  • Newbie
  • *
  • Posts: 4
Re: logging in from another page php
« Reply #6 on: June 28, 2012, 02:23:20 PM »
Wow, I'm so close. In testing, if I sign in as Bill, and log out of my app, then sign in as Bob, I see Bill's email. It appears that the sign-on only happens the first time. I've tried doing a /?_task=logout on page unload, but that doesn't seem to fix it.

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,882
    • SKaero - Custom Roundcube development
Re: logging in from another page php
« Reply #7 on: June 28, 2012, 03:25:58 PM »
Using the startup hook you could check if the correct user is logged in and if not destroy the session.