7#include <Cutelyst/Context>
8#include <Cutelyst/ParamsMultiMap>
9#include <Cutelyst/Request>
10#include <Cutelyst/Response>
11#include <cutelee/exception.h>
12#include <cutelee/parser.h>
14#ifdef PLUGIN_CSRFPROTECTION_ENABLED
15# include <Cutelyst/Plugins/CSRFProtection/CSRFProtection>
18Cutelee::Node *CSRFTag::getNode(
const QString &tagContent, Cutelee::Parser *p)
const
24CSRF::CSRF(Cutelee::Parser *parser)
25 : Cutelee::Node(parser)
29void CSRF::render(Cutelee::OutputStream *stream, Cutelee::Context *gc)
const
31#ifdef PLUGIN_CSRFPROTECTION_ENABLED
35 const QVariantHash hash = gc->stackHash(0);
36 auto it = hash.constBegin();
37 while (it != hash.constEnd()) {
38 if (it.value().userType() == qMetaTypeId<Cutelyst::Context *>()) {
41 m_cutelystContext = it.key();
57 qWarning(
"%s",
"The CSRF protection plugin has not been built.");
61Cutelee::Node *CSRFTokenTag::getNode(
const QString &tagContent, Cutelee::Parser *p)
const
64 return new CSRFToken(p);
67CSRFToken::CSRFToken(Cutelee::Parser *parser)
68 : Cutelee::Node(parser)
72void CSRFToken::render(Cutelee::OutputStream *stream, Cutelee::Context *gc)
const
74#ifdef PLUGIN_CSRFPROTECTION_ENABLED
78 const QVariantHash hash = gc->stackHash(0);
79 auto it = hash.constBegin();
80 while (it != hash.constEnd()) {
81 if (it.value().userType() == qMetaTypeId<Cutelyst::Context *>()) {
84 m_cutelystContext = it.key();
100 qWarning(
"%s",
"The CSRF protection plugin has not been built.");
104#include "moc_csrf.cpp"
static QByteArray getToken(Context *c)
static QString getTokenFormField(Context *c)
QString fromLatin1(QByteArrayView str)