Page 1 of 1

Problem loging out in local domain

Posted: Fri Jul 11, 2008 4:02 am
by JPhilip
I had a problem with the logout action deleting cookies on a local domain like localhost. (One without a dot)
I found that the serendipity_deleteCookie function was missing the same condition for local domains that the serendipity_setCookie has. (In functions_config.inc.php)

The cookies have to be deleted with sam host value as they were set, so for lacal domains, they cannot be deleted.

Adding the following lines after line 649 in the serendipity_deleteCookie function fixes the problem:

// If HTTP-Hosts like "localhost" are used, current browsers reject cookies.
// In this case, we disregard the HTTP host to be able to delete that cookie.
if (substr_count($host, '.') < 2) {
$host = '';

Re: Problem loging out in local domain

Posted: Fri Jul 11, 2008 11:20 am
by garvinhicking
Hi!

Thanks for the headsup. Wouldn't it be better to check, if the host has less than 1 dot instead of 2 dots? "garv.in" would be a valid domainname, and it only has one dot, so the host should not be removed from the cookie host in that case?!

Regards,
Garvin

Posted: Fri Jul 11, 2008 7:27 pm
by JPhilip
Yes, I guess so, I just copied the condition used to set the cookie, so that it is the same to set it and remove it, but you are right.
Apparently, at the moment, s9y is not using the domain to set the cookie for single dot domains in that case.
So both the setCookie and deleteCookie method could be corrected.

Posted: Mon Jul 14, 2008 10:02 am
by garvinhicking
Hi!

Thanks a lot for the input. I just committed it like you suggested.

Regards,
Garvin