From c332c0ed071b6c10569bf4d70a69b9b69499797d Mon Sep 17 00:00:00 2001 From: SharkyKZ Date: Thu, 10 May 2018 08:45:10 +0000 Subject: [PATCH] Fallback to integer --- plugins/authentication/cookie/cookie.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/plugins/authentication/cookie/cookie.php b/plugins/authentication/cookie/cookie.php index 9a611ec67b98b..9a2effc87ff71 100644 --- a/plugins/authentication/cookie/cookie.php +++ b/plugins/authentication/cookie/cookie.php @@ -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) @@ -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); @@ -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 {