Skip to content

Commit

Permalink
Fallback to integer (#20338)
Browse files Browse the repository at this point in the history
  • Loading branch information
SharkyKZ authored and Michael Babker committed May 23, 2018
1 parent bb5a446 commit 5e423b6
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions plugins/authentication/cookie/cookie.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ public function onUserAuthenticate($credentials, $options, &$response)
if (!JUserHelper::verifyPassword($cookieArray[0], $results[0]->token))
{
/*
* This is a real attack! Either the series was guessed correctly or a cookie was stolen and used twice (once by attacker and once by victim).
* This is a real attack!
* Either the series was guessed correctly or a cookie was stolen and used twice (once by attacker and once by victim).
* Delete all tokens for this user!
*/
$query = $this->db->getQuery(true)
Expand Down Expand Up @@ -294,8 +295,8 @@ public function onUserAfterLogin($options)
}

// Get the parameter values
$lifetime = $this->params->get('cookie_lifetime', '60') * 24 * 60 * 60;
$length = $this->params->get('key_length', '16');
$lifetime = $this->params->get('cookie_lifetime', 60) * 24 * 60 * 60;
$length = $this->params->get('key_length', 16);

// Generate new cookie
$token = JUserHelper::genRandomPassword($length);
Expand Down Expand Up @@ -334,9 +335,9 @@ public function onUserAfterLogin($options)
->where($this->db->quoteName('uastring') . ' = ' . $this->db->quote($cookieName));
}

$hashed_token = JUserHelper::hashPassword($token);
$hashedToken = JUserHelper::hashPassword($token);

$query->set($this->db->quoteName('token') . ' = ' . $this->db->quote($hashed_token));
$query->set($this->db->quoteName('token') . ' = ' . $this->db->quote($hashedToken));

try
{
Expand Down

0 comments on commit 5e423b6

Please sign in to comment.