Source for file cookie.php
Documentation is available at cookie.php
* @subpackage Authentication.cookie
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
* Joomla Authentication plugin
* @subpackage Authentication.cookie
* This method should handle any authentication and report back to the subject
* @param array $credentials Array holding the user credentials
* @param array $options Array of extra options
* @param object &$response Authentication response object
// No remember me for admin
if ($this->app->isAdmin())
$response->type =
'Cookie';
// We need to validate the cookie data because there may be no Remember Me plugin to do it.
// Create the cookie name and data.
if ($rememberArray ==
false)
list
($privateKey, $series, $uastring) =
$rememberArray;
// Find the matching record if it exists.
$query =
$this->db->getQuery(true)
->select($this->db->quoteName(array('user_id', 'token', 'series', 'time', 'invalid')))
->from($this->db->quoteName('#__user_keys'))
->where($this->db->quoteName('series') .
' = ' .
$this->db->quote(base64_encode($series)))
->where($this->db->quoteName('uastring') .
' = ' .
$this->db->quote($uastring))
->order($this->db->quoteName('time') .
' DESC');
$results =
$this->db->setQuery($query)->loadObjectList();
$countResults =
count($results);
// We have a user with one cookie with a valid series and a corresponding record in the database.
if (substr($results[0]->token, 0, 4) ===
'$2y$')
JLog::add(JText::sprintf('PLG_SYSTEM_REMEMBER_ERROR_LOG_LOGIN_FAILED', $user->username), JLog::WARNING, 'security');
if (!empty($options['lifetime']) &&
!empty($options['length']) &&
!empty($options['secure']))
$response->lifetime =
$options['lifetime'];
$response->length =
$options['length'];
$response->secure =
$options['secure'];
// Make sure there really is a user with this name and get the data for the session.
$query =
$this->db->getQuery(true)
->select($this->db->quoteName(array('id', 'username', 'password')))
->from($this->db->quoteName('#__users'))
->where($this->db->quoteName('username') .
' = ' .
$this->db->quote($credentials['username']));
$result =
$this->db->setQuery($query)->loadObject();
// Bring this in line with the rest of the system
// If there is no cookie, bail out
if (!$this->app->input->cookie->get($cookieName))
$response->username =
$result->username;
$response->email =
$user->email;
$response->fullname =
$user->name;
$response->password =
$result->password;
$response->language =
$user->getParam('language');
$response->error_message =
'';
$response->error_message =
JText::_('JGLOBAL_AUTH_NO_USER');
Documentation generated on Tue, 19 Nov 2013 14:57:34 +0100 by phpDocumentor 1.4.3