Skip to content
This repository was archived by the owner on Apr 21, 2026. It is now read-only.

Commit 2cf38e0

Browse files
authored
Merge pull request #297 from wheels-dev/fix/authenticity-token
Fix CSRF token missing on all POST forms
2 parents 3270cfb + 622fa85 commit 2cf38e0

21 files changed

Lines changed: 25 additions & 2 deletions

File tree

app/views/admin/AdminController/blog.cfm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
</div>
99
<div class="d-flex gap-2">
1010
<a href="#urlFor(route='blog-create')#" class="btn bg--primary text-white mb-3">Create New Article</a>
11-
<form id="bulkRejectForm" hx-post="/admin/bulkReject" hx-target="##responseTable" hx-swap="innerHTML"></form>
11+
<form id="bulkRejectForm" hx-post="/admin/bulkReject" hx-target="##responseTable" hx-swap="innerHTML">#authenticityTokenField()#</form>
1212
<button id="bulkRejectBtn" class="btn btn-ligh border solid mb-3">Reject Selected</button>
13-
<form id="bulkForm" hx-post="/admin/bulkApprove" hx-target="##responseTable" hx-swap="innerHTML"></form>
13+
<form id="bulkForm" hx-post="/admin/bulkApprove" hx-target="##responseTable" hx-swap="innerHTML">#authenticityTokenField()#</form>
1414
<button id="bulkApproveBtn" class="btn bg--primary text-white mb-3">Approve Selected</button>
1515
</div>
1616
</div>

app/views/admin/AdminController/editBlog.cfm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
</div>
1414
</cfif>
1515
<form id="blogForm" method="post" action='/admin/blog/blogUpdate/#blog.id#' class="needs-validation" novalidate hx-validate="true" enctype="multipart/form-data" onsubmit="document.getElementById('editLoader').style.display = 'block';">
16+
#authenticityTokenField()#
1617
<input type="hidden" name="_method" value="#isEdit ? 'PUT' : 'POST'#">
1718
<input class="form-control" type="hidden" name="id" id="id" value="#isEdit ? blog.id : ''#">
1819

app/views/admin/CategoriesController/add.cfm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
</div>
2525
<div class="row">
2626
<form class="row g-3 mb-6 needs-validation" id="categoryForm" novalidate hx-post="/admin/category/save" hx-target="body" hx-validate="true">
27+
#authenticityTokenField()#
2728
<input name="id" type="hidden" id="id" value="#id#">
2829

2930
<div class="col-sm-6 col-md-6 col-lg-12 mb-3">

app/views/admin/FeatureController/addFeature.cfm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
</div>
2626
<div class="row">
2727
<form class="row g-3 mb-6 needs-validation" id="featureForm" novalidate action="/admin/feature/store" method="post" hx-validate="true">
28+
#authenticityTokenField()#
2829
<input name="id" type="hidden" id="id" value="#id#">
2930

3031
<div class="col-sm-6 col-md-6 mb-3">

app/views/admin/NewsletterController/index.cfm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@
155155
</div>
156156
<div class="modal-body">
157157
<form hx-post="/admin/newsletter/send" hx-swap="none">
158+
#authenticityTokenField()#
158159
<div class="mb-3">
159160
<label for="subject" class="form-label mb-2">Newsletter Subject</label>
160161
<input type="text" class="form-control" id="subject" name="subject" placeholder="Enter newsletter subject" required>

app/views/admin/RolesController/add.cfm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
</div>
2424
<div class="row">
2525
<form class="row g-3 mb-6 needs-validation" id="RoleForm" novalidate hx-post="/admin/Role/save" hx-target="body" hx-validate="true">
26+
#authenticityTokenField()#
2627
<input name="id" type="hidden" id="id" value="#id#">
2728

2829
<div class="col-sm-6 col-md-6 mb-3">

app/views/admin/UserController/addUser.cfm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
</div>
3636
<div class="row">
3737
<form class="row g-3 mb-6 needs-validation" id="userForm" novalidate action="/admin/user/store" method="post" hx-validate="true">
38+
#authenticityTokenField()#
3839
<input name="id" type="hidden" id="id" value="#id#">
3940

4041
<div class="col-sm-6 col-md-6 mb-3">

app/views/admin/UserController/changePassword.cfm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<h1 class="fs-24 mb-0 fw-bold text--secondary text-center">Change Password</h1>
66

77
<form class="pt-3 px-1 needs-validation" id="changePasswordForm" novalidate hx-post="/admin/user/update-Password" hx-validate="true">
8+
<cfoutput>#authenticityTokenField()#</cfoutput>
89
<div class="mb-3">
910
<div class="bg--input d-flex align-items-center px-3 py-3 rounded-4 border gap-2">
1011
<svg width="20" height="20" class="flex-shrink-0" viewBox="0 0 24 24" fill="none"

app/views/admin/UserController/profile.cfm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525

2626
<form class="pt-3 px-1 needs-validation" id="userForm" novalidate hx-post="/admin/user/store" hx-validate="true" enctype="multipart/form-data">
27+
#authenticityTokenField()#
2728
<input name="id" type="hidden" id="id" value="#id#">
2829

2930
<div class="mb-3">

app/views/admin/UserController/updateProfilePic.cfm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
</cfoutput>
1414
</div>
1515
<form class="pt-3 px-1 needs-validation" id="profilePicForm" enctype="multipart/form-data" novalidate hx-post="/admin/user/upload-profile-pic" hx-validate="true">
16+
<cfoutput>#authenticityTokenField()#</cfoutput>
1617
<div class="mb-3">
1718
<label for="formFile" class="form-label">Profile Picture</label>
1819
<input type="file" id="imageInput" class="form-control" name="profilePic" accept="image/*" required>

0 commit comments

Comments
 (0)