| View previous topic :: View next topic |
| Author |
Message |
mlovelock
Joined: 26 Feb 2008 Posts: 4
|
Posted: Tue Feb 26, 2008 5:10 pm Post subject: integration and session variables |
|
|
I am looking to integrate Thyme into a pre-existing user authentication system.
With the Generic MySQL Authentication module I can obviously use the same user details, but I also wish to log users into the diary system at the same time as they log in to the rest of the site.
I thought perhaps the easiest way to do this would be to manually register the required session variables for Thyme - would this work, and what would those Session variables be? Also, I presume on logout I would just need to destroy those session values?
Many thanks,
Michael. |
|
| Back to top |
|
 |
esoft_ian
Joined: 12 Sep 2005 Posts: 5268
|
Posted: Tue Feb 26, 2008 5:19 pm Post subject: |
|
|
Hi,
Please see this. Let me know if you have any questions or trouble at all. |
|
| Back to top |
|
 |
mlovelock
Joined: 26 Feb 2008 Posts: 4
|
Posted: Tue Mar 11, 2008 1:09 am Post subject: integration and session variables |
|
|
Hi,
Thanks for your reply, I've just now had the chance to try implementing this.
What I'm finding at present is that I'm getting the desired result on login, but not on logout.
At present, I've added the following code to the generic mysql auth file (auth.php) as suggested in the post:
| Code: |
session_start();
if($_SESSION['kt_login_id']) {
$_SESSION['uid'] = $_SESSION['kt_login_id'];
define("_CAL_REUSE_SESSION_", 1);
}
|
This logs me in fine, but I'm a little confused as to what I need to do in terms of logout. My site logout unsets the session variables and logs the user out. However, when I go back to the calendar and refresh the page, the user is then logged back in, and my site session variables are reinstated.
Is the calendar re-using the session in some way? Do I need to unset / destroy a session var that I'm not at present?
Many thanks,
Michael |
|
| Back to top |
|
 |
esoft_ian
Joined: 12 Sep 2005 Posts: 5268
|
Posted: Tue Mar 11, 2008 2:48 pm Post subject: |
|
|
Hi,
This is because Thyme instantiates its own session. To make it so that a user can only be logged into Thyme when also logged into your main app or intranet, change the code to:
| Code: |
session_start();
if($_SESSION['kt_login_id']) {
$_SESSION['uid'] = $_SESSION['kt_login_id'];
} else {
$_SESSION['uid'] = 0;
}
define("_CAL_REUSE_SESSION_", 1); |
|
|
| Back to top |
|
 |
mlovelock
Joined: 26 Feb 2008 Posts: 4
|
Posted: Tue Mar 11, 2008 4:05 pm Post subject: |
|
|
Hi,
This seems to provide a partial answer, though I can't quite figure out why. Here's what's happening:
1. User logs out - all my session vars are unset (confirmed)
2. User returns to calendar index - at this point, 'UID' is set to '0', but calendar also reinstates (or still holds) 'kt_login_id' and other vars to their previous states / values (confirmed)
3. If user then refreshes the calendar page, they are effectively logged in again, to the whole site and the calendar.
Is this because thyme is reusing my session and so still holds its own copies of the session vars? How do I ensure we don't end up being logged back in again - do I need to unset/destroy the thyme session?
Many thanks for your help and speedy responses,
Michael |
|
| Back to top |
|
 |
esoft_ian
Joined: 12 Sep 2005 Posts: 5268
|
Posted: Tue Mar 11, 2008 4:10 pm Post subject: |
|
|
Hi,
You don't want to destroy the whole session. Do this instead actually:
| Code: |
session_start();
if($_SESSION['kt_login_id']) {
$_SESSION['uid'] = $_SESSION['kt_login_id'];
} else {
unset($_SESSION['kt_login_id']);
$_SESSION['uid'] = 0;
}
define("_CAL_REUSE_SESSION_", 1); |
Let me know if this does not work. |
|
| Back to top |
|
 |
mlovelock
Joined: 26 Feb 2008 Posts: 4
|
Posted: Tue Mar 11, 2008 4:44 pm Post subject: |
|
|
| Hi, no luck there I'm afraid. Still the same outcome. Sorry to be so awkward! |
|
| Back to top |
|
 |
esoft_ian
Joined: 12 Sep 2005 Posts: 5268
|
Posted: Wed Mar 12, 2008 4:59 pm Post subject: |
|
|
| Would it be at all possible for you to send me a private message (click on the "PM" icon under this post) containing the FTP login and site login info please? |
|
| Back to top |
|
 |
|