The code in session authentication has following conditions:

  //If the user is logged in already and the callback contains the string login
  //we need to set it to the original user so that the already logged in as @user message
  //is displayed
  if (strpos($arg[1]['callback'], 'login') !== FALSE) {
    if($original_user->uid != 0) {
      $user = $original_user;
    }
  }
  //For every callback that has nothing to do with login we need to
  //set it to the original user so that they are no longer anonymous
  
  if (strpos($arg[1]['callback'], 'login') === FALSE) {
    // The account should be restored to the session's user.
    $user = $original_user;
  }

This means that only in one case we do not do $user = $original_user; and that case is when anonymous user calls "login" method. But we change user object to anonymous user anyway. So we simply to not change one anonymous user object with another and that does not make much sense.

What I propose is to simplify all these conditions with simple:

$user = $original_user;

without any conditions.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ygerasimov’s picture

ygerasimov’s picture

Status: Active » Needs review
ygerasimov’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.