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> 18 Cutelee::Node *CSRFTag::getNode(
const QString &tagContent, Cutelee::Parser *p)
const 24 CSRF::CSRF(Cutelee::Parser *parser)
29 void CSRF::render(Cutelee::OutputStream *stream, Cutelee::Context *gc)
const 31 #ifdef PLUGIN_CSRFPROTECTION_ENABLED 35 const QVariantHash hash = gc->stackHash(0);
36 for (
const auto &[key, value] : hash.asKeyValueRange()) {
37 if (value.userType() == qMetaTypeId<Cutelyst::Context *>()) {
40 m_cutelystContext = key;
51 *stream << Cutelyst::CSRFProtection::getTokenFormField(c);
55 qWarning(
"%s",
"The CSRF protection plugin has not been built.");
59 Cutelee::Node *CSRFTokenTag::getNode(
const QString &tagContent, Cutelee::Parser *p)
const 62 return new CSRFToken(p);
65 CSRFToken::CSRFToken(Cutelee::Parser *parser)
70 void CSRFToken::render(Cutelee::OutputStream *stream, Cutelee::Context *gc)
const 72 #ifdef PLUGIN_CSRFPROTECTION_ENABLED 76 const QVariantHash hash = gc->stackHash(0);
77 for (
const auto &[key, value] : hash.asKeyValueRange()) {
78 if (value.userType() == qMetaTypeId<Cutelyst::Context *>()) {
81 m_cutelystContext = key;
96 qWarning(
"%s",
"The CSRF protection plugin has not been built.");
100 #include "moc_csrf.cpp"
QString fromLatin1(QByteArrayView str)