cvs: pear /LiveUser LiveUser.php
| From: | Lukas Smith | Date: | Mon, 07 Feb 2005 16:24:11 +0000 |
| Subject: | cvs: pear /LiveUser LiveUser.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-29180@lists.php.net to get a copy of this message | ||
lsmith Mon Feb 7 11:24:11 2005 EDT
Modified files:
/pear/LiveUser LiveUser.php
Log:
- more clean ups in init() method ... moved remember me handling into the login() method
http://cvs.php.net/diff.php/pear/LiveUser/LiveUser.php?r1=1.41&r2=1.42&ty=u
Index: pear/LiveUser/LiveUser.php
diff -u pear/LiveUser/LiveUser.php:1.41 pear/LiveUser/LiveUser.php:1.42
--- pear/LiveUser/LiveUser.php:1.41 Mon Feb 7 11:11:32 2005
+++ pear/LiveUser/LiveUser.php Mon Feb 7 11:24:10 2005
@@ -156,7 +156,7 @@
* @author Lukas Smith <smith@backendmedia.com>
* @author Pierre-Alain Joye <pajoye@php.net>
* @author Arnaud Limbourg <arnaud@php.net>
- * @version $Id: LiveUser.php,v 1.41 2005/02/07 16:11:32 lsmith Exp $
+ * @version $Id: LiveUser.php,v 1.42 2005/02/07 16:24:10 lsmith Exp $
* @package LiveUser
*/
class LiveUser
@@ -894,23 +894,12 @@
// Try to fetch auth object from session
$this->unfreeze();
- // If the user did not previously authenticate and is neither
- // logging out or login in, check if there is a remember me cookie
- if (!$this->isLoggedIn() && !$logout && empty($handle)) {
- $result = $this->readRememberCookie();
- if (is_array($result)) {
- $handle = $result['handle'];
- $passwd = $result['passwd'];
- }
- }
-
- if ($logout || $handle) {
- $this->logout($logout);
- }
-
if ($this->isLoggedIn()) {
+ // user wants to logout or authenticate with new credentials
+ if ($logout || $handle)) {
+ $this->logout($logout);
// Check if user authenticated with new credentials
- if ($handle && $this->_auth->handle != $handle) {
+ } elseif ($handle && $this->_auth->handle != $handle) {
$this->logout(false);
} elseif ($this->_auth->expireTime > 0 &&
$this->_auth->currentLogin > 0) {
// Check if authentication session is expired.
@@ -960,9 +949,12 @@
*/
function login($handle = '', $passwd = '', $remember = false)
{
- // if we remove this we could allow anonymous login?
if (empty($handle)) {
- return false;
+ $result = $this->readRememberCookie();
+ if (is_array($result)) {
+ $handle = $result['handle'];
+ $passwd = $result['passwd'];
+ }
}
$counter = 0;