Skip to content

Commit

Permalink
Ensure that UserID matches database when logging in (#3178)
Browse files Browse the repository at this point in the history
The MySQL string comparison in SinglePointLogin was
authenticating in a case-insensitive manner, resulting
in various places in the code failing if they tried to
compare $_SESSION['State']->getUsername() (which has
the value from when the user logged in) with User::singleton()->getUsername()
(which has the value from the database) in PHP (which,
unlike MySQL, *is* case sensitive.)

This updates the SinglePointLogin class so that it uses
the username from the database, rather than the HTTP request
for the username in $_SESSION['State'].
  • Loading branch information
driusan committed Oct 17, 2017
1 parent 87c7fa4 commit 89ddc81
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion php/libraries/SinglePointLogin.class.inc
Expand Up @@ -400,6 +400,7 @@ class SinglePointLogin

// check users table to see if we have a valid user
$query = "SELECT COUNT(*) AS User_count,
UserID,
Password_expiry,
Active,
Pending_approval,
Expand Down Expand Up @@ -450,7 +451,7 @@ class SinglePointLogin
}

// user is valid
$this->_username = $username;
$this->_username = $row['UserID'];

$result = $DB->insert('user_login_history', $setArray);
return true;
Expand Down

0 comments on commit 89ddc81

Please sign in to comment.