Skip to content
This repository was archived by the owner on Nov 30, 2022. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions RoundcubeAutoLogin.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function login($email, $password)
if($response_info['http_code'] == 302)
{
// find all relevant cookies to set (php session + rc auth cookie)
preg_match_all('/Set-Cookie: (.*)\b/', $response, $cookies);
preg_match_all('/set-cookie: (.*)\b/i', $response, $cookies);

$cookie_return = array();

Expand Down Expand Up @@ -147,7 +147,8 @@ private function _get_token()


// set your roundcube domain path
$rc = new RoundcubeAutoLogin('http://domain.com/roundcube/');
$rc = new RoundcubeAutoLogin('https://www.example.com/');

$cookies = $rc->login($rcuser, $rcpass);

// now you can set the cookies with setcookie php function, or using any other function of a framework you are using
Expand All @@ -160,5 +161,8 @@ private function _get_token()
// and redirect to roundcube with the set cookies
$rc->redirect();
}
else{
echo 'Login failed, please check your credentials';
}

?>