diff options
author | Dries Buytaert <dries@buytaert.net> | 2006-01-26 08:51:10 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2006-01-26 08:51:10 +0000 |
commit | 794b53e19523bc1e4c6228d50c3b298314199051 (patch) | |
tree | d73220ffd09466077d1ce587866c34f727cb28cd | |
parent | 20154df528fefb072663037256ecbccb29bac7f5 (diff) | |
download | brdo-794b53e19523bc1e4c6228d50c3b298314199051.tar.gz brdo-794b53e19523bc1e4c6228d50c3b298314199051.tar.bz2 |
- Patch #46137 by drumm/moshe: load anonymous user if authentication failed.
-rw-r--r-- | modules/user.module | 6 | ||||
-rw-r--r-- | modules/user/user.module | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/modules/user.module b/modules/user.module index 405607a7b..e91ba37e6 100644 --- a/modules/user.module +++ b/modules/user.module @@ -884,8 +884,10 @@ function user_login_submit($form_id, $form_values) { function user_authenticate($name, $pass) { global $user; - // Try to log in the user locally: - $user = user_load(array('name' => $name, 'pass' => $pass, 'status' => 1)); + // Try to log in the user locally. Don't set $user unless successful. + if ($account = user_load(array('name' => $name, 'pass' => $pass, 'status' => 1))) { + $user = $account; + }; // Strip name and server from ID: if ($server = strrchr($name, '@')) { diff --git a/modules/user/user.module b/modules/user/user.module index 405607a7b..e91ba37e6 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -884,8 +884,10 @@ function user_login_submit($form_id, $form_values) { function user_authenticate($name, $pass) { global $user; - // Try to log in the user locally: - $user = user_load(array('name' => $name, 'pass' => $pass, 'status' => 1)); + // Try to log in the user locally. Don't set $user unless successful. + if ($account = user_load(array('name' => $name, 'pass' => $pass, 'status' => 1))) { + $user = $account; + }; // Strip name and server from ID: if ($server = strrchr($name, '@')) { |