public getUserFromCookie ( $cookie ) : |
||
return | the user instance generated based on the cookie auth data, null if the cookie does not have valid auth data. |
public function getUserFromCookie($cookie)
{
if (($data = $cookie->getValue()) !== '') {
$data = unserialize($data);
if (is_array($data) && count($data) === 2) {
list($username, $token) = $data;
if (isset($this->_users[$username]) && $token === md5($username . $this->_users[$username])) {
return $this->getUser($username);
}
}
}
return null;
}