Author Topic: Set RC Cookie  (Read 7207 times)

Offline redwall_hp

  • Newbie
  • *
  • Posts: 2
Set RC Cookie
« on: April 15, 2007, 12:32:17 PM »
Okay, I'm trying to integrate RoundCube with my custom login script so when I login with my script, it will log me in to RoundCube. All I need is a little info about RC's cookies. Does anyone know how to set RC's session cookies? I can't seem to find out where RoundCube's login routines are. All I've found out is that the cookies are named sessid and sessauth. Anyone know the info I need?

Offline bpat1434

  • Administrator
  • Hero Member
  • *****
  • Posts: 673
Re: Set RC Cookie
« Reply #1 on: June 01, 2007, 08:21:38 PM »
The login routines are in /program/include/main.inc file. It's performed by the function rcmail_login.

Here's the session setting stuff from that function. Please note that you really need to look at the function so you know and understand what it's doing. Otherwise, you'll be plagued with failed login attempts.

 if ($user_id)
  {
  
$_SESSION['user_id']  = $user_id;
  
$_SESSION['imap_host'] = $host;
  
$_SESSION['imap_port'] = $imap_port;
  
$_SESSION['imap_ssl'] = $imap_ssl;
  
$_SESSION['username'] = $user;
  
$_SESSION['user_lang'] = $sess_user_lang;
  
$_SESSION['password'] = encrypt_passwd($pass);
  
$_SESSION['login_time'] = mktime();

  
// force reloading complete list of subscribed mailboxes
  
rcmail_set_imap_prop();
  
$IMAP->clear_cache('mailboxes');
  
$IMAP->create_default_folders();

  return 
TRUE;
  }