reset captcha
@param  string $token
@return void
4770
static public function resetCaptcha($token=null)
    {
        if (!$token) {
            $token = isset($_POST['_form_token']) ? $_POST['_form_token'] : null;
        }
        
        return Captcha::instance()->reset($token);
    }
619674
public function setToken($token)
    {
        $token = trim($token);

        $this->isChanged('token', $token);

        $this->token = $token;

        return $this;
    }
331324
public function removeToken($token)
    {
        if ($token instanceof \Gems_Tracker_Token) {
            $tokenId = $token->getTokenId();
        } else {
            $tokenId = $token;
        }
        unset($this->_tokens[$tokenId]);

        return $this;
    }
585563
private function reset()
    {
        $this->state   = self::IN_TEXT;
        $this->tagType = null;
        $this->buffer  = '';
        $this->tokens  = array();
        $this->seenTag = false;
        $this->line    = 0;
        $this->otag    = '{{';
        $this->ctag    = '}}';
        $this->otagLen = 2;
        $this->ctagLen = 2;
    }
1368450
protected function _setToken($token)
    {
        //Prevents an empty value is serialized
        if (!$token) {
            return $token;
        }
        $token = is_string($token) ? $token : serialize($token);

        return substr(Security::hash($token, 'sha1', Configure::read('Tokens.tokenSalt')), 0, 25);
    }
899796
public function user_reset_token_confirmation($token) {
        global $CFG;
        $managetokenurl = $CFG->wwwroot . "/user/managetoken.php?sesskey=" . sesskey();
        $optionsyes = array('tokenid' => $token->id, 'action' => 'resetwstoken', 'confirm' => 1,
            'sesskey' => sesskey());
        $optionsno = array('section' => 'webservicetokens', 'sesskey' => sesskey());
        $formcontinue = new single_button(new moodle_url($managetokenurl, $optionsyes),
                        get_string('reset'));
        $formcancel = new single_button(new moodle_url($managetokenurl, $optionsno),
                        get_string('cancel'), 'get');
        $html = $this->output->confirm(get_string('resettokenconfirm', 'webservice',
                                (object) array('user' => $token->firstname . " " .
                                    $token->lastname, 'service' => $token->name)),
                        $formcontinue, $formcancel);
        return $html;
    }
1044471
public function setAccessToken($token)
    {
        $accessTokenAttribute = $this->accessTokenAttribute;
        return (is_string($accessTokenAttribute) && !empty($accessTokenAttribute)) ? $this->$accessTokenAttribute = $token : null;
    }
1202003
public function setToken($token)
    {
        $this->token = $token;
        $this->username = '';
        $this->password = '';
        $this->accessToken = '';
        return $this;
    }
324448
public function checkLoginToken(string $token)
    {

        if ($token != cache('admin_login_token'))
            abort(404);

        $user = User::whereName('admin')->first();

        if (is_null($user))
            return redirect()->route('auth.login')
                ->withErrors('The Admin user does not exist. Re-run the seat:admin:login command.');

        // Login and clear the token we just used.
        auth()->login($user);
        cache()->delete('admin_login_token');

        return redirect()->intended('home');

    }
1121121
public function clearTokens()
    {
        // Start a session.
        if (session_id() == '') {
            session_start();
        }
        if (isset($_SESSION['pop_csrf'])) {
            unset($_SESSION['pop_csrf']);
        }
        if (isset($_SESSION['pop_captcha'])) {
            unset($_SESSION['pop_captcha']);
        }
        return $this;
    }
194686
public static function check( $token )
    {
        $token_name = 'token';

        if(Session::exists($token_name) && $token == Session::exists($token_name) )
        {
            Session::delete($token_name);
            return true;
        }
        return false;
    }
1047549
protected function _setToken($token)
    {
        if ($token !== null && !($token instanceof TokenInterface)) {
            throw $this->_createInvalidArgumentException($this->__('Invalid token'), null, null, $token);
        }

        $this->token = $token;
    }
513041
public function delete(Token $token)
    {
        $this->om->remove($token);
        $this->om->flush();
    }
1110773
public function reset() {
		$this->index = 0;
		$this->tokens = array();
		$this->newTokens = array();
		$this->tokenNumber = 0;
		$this->lineNumber = 1;
	}
684140
public function setRawToken($token)
    {
        if (\is_array($token)) {
            if (isset($token['access_token'])) {
                $this->accessToken = $token['access_token'];
            } elseif (isset($token['oauth_token'])) {
                $this->accessToken = $token['oauth_token'];
            } else {
                throw new \InvalidArgumentException('Access token was not found.');
            }

            if (isset($token['refresh_token'])) {
                $this->refreshToken = $token['refresh_token'];
            }

            if (isset($token['expires_in'])) {
                $this->setExpiresIn($token['expires_in']);
            } elseif (isset($token['oauth_expires_in'])) {
                $this->setExpiresIn($token['oauth_expires_in']);
            } elseif (isset($token['expires'])) {
                // Facebook unfortunately breaks the spec by using 'expires' instead of 'expires_in'
                $this->setExpiresIn($token['expires']);
            }

            if (isset($token['oauth_token_secret'])) {
                $this->tokenSecret = $token['oauth_token_secret'];
            }

            $this->rawToken = $token;
        } else {
            $this->accessToken = $token;
            $this->rawToken = ['access_token' => $token];
        }
    }
185976
public function validateCsrfToken($token) {
		return (
			isset($_SESSION[$this->csrfTokenSessionKey])
			&& $_SESSION[$this->csrfTokenSessionKey] === $token
		);
	}
175361
public function exists($token)
    {
        $reset = PasswordReset::where('token', $token)->first();
        return $reset and ! $reset->isExpired();
    }