cvs: pearweb /include pear-auth.php
| From: | Stig Bakken | Date: | Thu, 25 Apr 2002 01:17:30 +0000 |
| Subject: | cvs: pearweb /include pear-auth.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-3532@lists.php.net to get a copy of this message | ||
ssb Wed Apr 24 21:17:30 2002 EDT
Modified files:
/pearweb/include pear-auth.php
Log:
* clean up error logging
Index: pearweb/include/pear-auth.php
diff -u pearweb/include/pear-auth.php:1.19 pearweb/include/pear-auth.php:1.20
--- pearweb/include/pear-auth.php:1.19 Wed Apr 17 22:14:08 2002
+++ pearweb/include/pear-auth.php Wed Apr 24 21:17:30 2002
@@ -58,6 +58,7 @@
if (empty($auth_user)) {
$auth_user = new PEAR_User($dbh, $user);
}
+ $error = '';
$ok = false;
switch (strlen(@$auth_user->password)) {
// handle old-style DES-encrypted passwords
@@ -67,7 +68,7 @@
if ($crypted == @$auth_user->password) {
$ok = true;
} else {
- error_log("pear-auth: user `$user': invalid password (des)", 0);
+ $error = "pear-auth: user `$user': invalid password (des)";
}
break;
}
@@ -77,13 +78,15 @@
if ($crypted == @$auth_user->password) {
$ok = true;
} else {
- error_log("pear-auth: user `$user': invalid password (md5)", 0);
+ $error = "pear-auth: user `$user': invalid password (md5)";
}
break;
}
}
if (empty($auth_user->registered)) {
- error_log("pear-auth: user `$user' not registered", 0);
+ if ($user) {
+ $error = "pear-auth: user `$user' not registered";
+ }
$ok = false;
}
if (!$ok) {
@@ -93,8 +96,15 @@
$ok = true;
}
}
- $auth_user->_readonly = true;
- return $ok;
+ if ($ok) {
+ $auth_user->_readonly = true;
+ return true;
+ }
+ if ($error) {
+ error_log($error, 0);
+ }
+ $auth_user = null;
+ return false;
}
function auth_require($admin = false, $refresh = false)