Commit 794b53e1 authored by Dries's avatar Dries
Browse files

- Patch #46137 by drumm/moshe: load anonymous user if authentication failed.

parent 20154df5
...@@ -884,8 +884,10 @@ function user_login_submit($form_id, $form_values) { ...@@ -884,8 +884,10 @@ function user_login_submit($form_id, $form_values) {
function user_authenticate($name, $pass) { function user_authenticate($name, $pass) {
global $user; global $user;
// Try to log in the user locally: // Try to log in the user locally. Don't set $user unless successful.
$user = user_load(array('name' => $name, 'pass' => $pass, 'status' => 1)); if ($account = user_load(array('name' => $name, 'pass' => $pass, 'status' => 1))) {
$user = $account;
};
// Strip name and server from ID: // Strip name and server from ID:
if ($server = strrchr($name, '@')) { if ($server = strrchr($name, '@')) {
......
...@@ -884,8 +884,10 @@ function user_login_submit($form_id, $form_values) { ...@@ -884,8 +884,10 @@ function user_login_submit($form_id, $form_values) {
function user_authenticate($name, $pass) { function user_authenticate($name, $pass) {
global $user; global $user;
// Try to log in the user locally: // Try to log in the user locally. Don't set $user unless successful.
$user = user_load(array('name' => $name, 'pass' => $pass, 'status' => 1)); if ($account = user_load(array('name' => $name, 'pass' => $pass, 'status' => 1))) {
$user = $account;
};
// Strip name and server from ID: // Strip name and server from ID:
if ($server = strrchr($name, '@')) { if ($server = strrchr($name, '@')) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment