Prado\Security\TUserManager::getUserFromCookie PHP Method

getUserFromCookie() public method

Returns a user instance according to auth data stored in a cookie.
Since: 3.1.1
public getUserFromCookie ( $cookie ) : TUser
return TUser 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;
    }