protected function generateCsrfToken()
    {
        $token = Reaction::$app->security->generateRandomString();
        if ($this->enableCsrfCookie) {
            $cookie = $this->createCsrfCookie($token);
            $this->app->response->getCookies()->add($cookie);
        } else {
            $this->app->session->set($this->csrfParam, $token);
        }

        return $token;
    }