Roundcube Community Forum

 

Set RC Cookie

Started by redwall_hp, April 15, 2007, 12:32:17 PM

Previous topic - Next topic

redwall_hp

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?

bpat1434

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;
  }