Added csrf tokens to the existing forms.

This commit is contained in:
Relintai 2022-01-09 16:03:54 +01:00
parent 73df53418a
commit 0c6c20bd64
2 changed files with 10 additions and 0 deletions

View File

@ -182,6 +182,8 @@ void RBACController::render_rank_view(Request *request, RBACAdminRankViewData *d
b.form()->method("POST")->action(request->get_url_root() + String::num(id));
{
b.csrf_token(request);
//b.input()->type("hidden")->name("id")->value(String::num(id))->f()->cinput();
b.w("Name:")->br();
b.input()->type("text")->name("name")->value(name)->f()->br();
@ -401,6 +403,8 @@ void RBACController::admin_render_permission_editor_entry_edit_create_view(Reque
b.form()->method("POST")->action(request->get_url_root());
{
b.csrf_token(request);
b.w("Name:")->br();
b.input()->type("text")->name("name")->value(name)->f()->br();
b.w("URL:")->br();

View File

@ -112,6 +112,8 @@ void UserController::render_login_request_default(Request *request, LoginRequest
// todo href path helper
b.form()->method("POST")->href("/user/login");
{
b.csrf_token(request);
b.w("Username");
b.br();
b.input()->type("text")->name("username")->value(data->uname_val);
@ -226,6 +228,8 @@ void UserController::render_register_request_default(Request *request, RegisterR
// todo href path helper
b.form()->method("POST")->href("/user/register");
{
b.csrf_token(request);
b.w("Username");
b.br();
b.input()->type("text")->name("username")->value(data->uname_val);
@ -396,6 +400,8 @@ void UserController::render_settings_request(Ref<User> &user, Request *request,
// todo href path helper
b.form()->method("POST")->href("/user/settings");
{
b.csrf_token(request);
b.w("Username");
b.br();
b.input()->type("text")->name("username")->placeholder(user->name_user_input)->value(data->uname_val);