Roundcube Community Forum

Miscellaneous => Roundcube Discussion => Topic started by: redwall_hp on April 15, 2007, 12:32:17 PM

Title: Set RC Cookie
Post by: redwall_hp 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?
Title: Re: Set RC Cookie
Post by: bpat1434 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;
  }