PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Authentication » LiveUser » Bug #943

Logout problematic

Details

Submitted2004-03-04 06:42 UTC
Fromalain_d99 at freesurf dot ch
Assignedlsmith
StatusClosed
PackageLiveUser
PHP Version4.2.1
OSWindows
Roadmaps(Not assigned)

Comments

[2004-03-04 06:42 UTC] alain_d99 at freesurf dot ch

Description:
------------
Hello,

LiveUser.php: v1.79

I use the following schema:
Config (partial):
logout => array(
'trigger' => 'logout',
'destroy' => true
)
File:
AdminUser.php

In the AdminUser.php, I use the code:
$nLiveUser =& LiveUser::factory($Config);

$nResult = $nLiveUser->init();
if(PEAR::isError($nResult))
HandleError1....

if(!$nResult)
HandleError2...

$if($nLiveUser->isLoggedIn()) {}
else {
HandleNotLogged...
}

The login process works perfectly well when I call:
AdminUser.php?lang=fr

if I call the following URL to logout:

AdminUser.php?lang=fr&logout=1

the logout is made correctly and I go into the HandleError2.

BUT I don't know if it is an error (cookies not set in browser by example when I log in) or a logout if I only use the LiveUser class, the 'status' gives me always LIVEUSER_STATUS_UNKNOWN.

It would be great if the logout is clearly designed from LiveUser::init() if we don't use the key 'redirect' in the Config variable (here because I give lang=fr in the URL, a dynamic variable).

Hope I am clear.

Thank for your work,
Alain

[2004-03-06 09:23 UTC] alain_d99 at freesurf dot ch

Hello Smith,

I copy your patch and test it. An error to correct in your patch in line ~769:

if (!is_null($this->status)) {
$this->status = LIVEUSER_STATUS_UNKNOWN;
}
return false;

would be
if (is_null($this->status)) { // STATUS MUST BE NULL
$this->status = LIVEUSER_STATUS_UNKNOWN;
}
return false;

And your solution works perfectly well, thanks Smith.
Alain

[2004-03-08 12:44 UTC] alain_d99 at freesurf dot ch

Hello Smith,

another corrections with the introduction of LIVUSER_STATUS_LOGGEDOUT: processLogout() function sets the status variable, then in init() function:

line: ~731
if ($lulogin &&
$this->_auth->loggedIn &&
$this->_auth->expireTime > 0 &&
$this->_auth->currentLogin > 0 &&
($this->_auth->currentLogin + $this->_auth->expireTime) < time()
) {
$this->expired = true;
$this->status = LIVEUSER_STATUS_EXPIRED;
$this->processLogout(true);
}

would be:
if ($lulogin &&
$this->_auth->loggedIn &&
$this->_auth->expireTime > 0 &&
$this->_auth->currentLogin > 0 &&
($this->_auth->currentLogin + $this->_auth->expireTime) < time()
) {
$this->expired = true;
$this->processLogout(true); //SWAP THE LAST TWO LINES
$this->status = LIVEUSER_STATUS_EXPIRED; //NOW, OK
}

Must be made for LIVEUSER_STATUS_IDLED condition too.

Thank, and greetings,
Alain

PS: my comment in #942 about redundancy of status, idled and expired variables can be problematic here, because logout() function use idled and expired variables and change the status variable