Added an another csrf token helper.

This commit is contained in:
Relintai 2022-01-09 15:00:59 +01:00
parent 58411bdb7d
commit 4c6e02d07f
2 changed files with 10 additions and 0 deletions

View File

@ -18,6 +18,14 @@ Ref<HTTPSession> Request::get_or_create_session() {
return session;
}
bool Request::has_csrf_token() {
if (!session.is_valid()) {
return false;
}
return session->has("csrf_token");
}
String Request::get_csrf_token() {
if (!session.is_valid()) {
return "";

View File

@ -39,6 +39,8 @@ public:
std::map<String, Ref<Reference> > reference_data;
Ref<HTTPSession> get_or_create_session();
bool has_csrf_token();
String get_csrf_token();
virtual const String get_cookie(const String &key);