protected function isValidToken($value)
    {
        // Make sure the value has the right format
        $value   = $this->tracker->filterToken($value);
        $library = $this->tracker->getTokenLibrary();
        $format  = $library->getFormat();
        $reuse   = $library->hasReuse() ? $library->getReuse() : -1;

        if (strlen($value) !== strlen($format)) {
            $this->_messages = sprintf($this->translate->_('Not a valid token. The format for valid tokens is: %s.'), $format);
            return false;
        }

        $token = $this->tracker->getToken($value);
        if ($token && $token->exists && $token->getReceptionCode()->isSuccess()) {
            $currentDate = new \MUtil_Date();

            if ($completionTime = $token->getCompletionTime()) {
                // Reuse means a user can use an old token to check for new surveys
                if ($reuse >= 0) {
                    // Oldest date AFTER completiondate. Oldest date is today minus reuse time
                    if ($currentDate->diffDays($completionTime) <= $reuse) {
                        // It is completed and may still be used to look
                        // up other valid tokens.
                        return true;
                    }
                }
                $this->_messages = $this->translate->_('This token is no longer valid.');
                return false;
            }

            $fromDate = $token->getValidFrom();
            if ((null === $fromDate) || $currentDate->isEarlier($fromDate)) {
                // Current date is BEFORE from date
                $this->_messages = $this->translate->_('This token cannot (yet) be used.');
                return false;
            }

            if ($untilDate = $token->getValidUntil()) {
                if ($currentDate->isLater($untilDate)) {
                    //Current date is AFTER until date
                    $this->_messages = $this->translate->_('This token is no longer valid.');
                    return false;
                }
            }

            return true;
        } else {
            $this->_messages = $this->translate->_('Unknown token.');
            return false;
        }
    }