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

Commit d3bb47a

Browse files
bpamiriclaude
andcommitted
fix: Replace remaining params=[] in models, views, and event handler
The previous commit fixed controllers only. This catches the remaining broken params=[] calls in models (LoginAttempt, User, RememberToken, PasswordReset), views (blog, comments, categories), event handler (remember-me auth), and BlogController title uniqueness check. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent be1aa8f commit d3bb47a

11 files changed

Lines changed: 23 additions & 26 deletions

File tree

app/controllers/web/BlogController.cfc

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -653,15 +653,13 @@ component extends="app.Controllers.Controller" {
653653
);
654654

655655
if(structKeyExists(form, "title")) {
656-
var whereClause = "title = ?";
657-
var whereParams = [form.title];
656+
var whereClause = "title = '#form.title#'";
658657

659658
if(structKeyExists(form, "id") && isNumeric(form.id) && form.id > 0) {
660-
whereClause &= " AND id != ?";
661-
arrayAppend(whereParams, form.id);
659+
whereClause &= " AND id != #val(form.id)#";
662660
}
663661

664-
var blogModel = model("Blog").findAll(where=whereClause, params=whereParams);
662+
var blogModel = model("Blog").findAll(where=whereClause);
665663

666664
if(blogModel.recordCount != 0) {
667665
renderText('<span class="text-danger">A blog already exists with this title!</span><input type="hidden" id="titleExists" value="1">');
@@ -792,9 +790,8 @@ component extends="app.Controllers.Controller" {
792790
}
793791

794792
// Fetch all related users at once
795-
var authorPlaceholders = repeatString("?,", arrayLen(authorIds));
796-
authorPlaceholders = left(authorPlaceholders, len(authorPlaceholders) - 1);
797-
authors = model("User").findAll(where="id IN (#authorPlaceholders#)", params=authorIds, returnAs="structs");
793+
var authorIdList = arrayToList(authorIds);
794+
authors = model("User").findAll(where="id IN (#authorIdList#)", returnAs="structs");
798795

799796
// Map authors by ID for quick lookup
800797
authorMap = {};

app/events/onrequeststart.cfm

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ if (!structKeyExists(session, "userID") && structKeyExists(cookie, "remember_me"
2424
2525
// Look up remember-me record
2626
var record = model("RememberToken").findOne(
27-
where = "token = ? AND expiresAt > ? AND userAgent = ?", params = [hashedToken, now(), cgi.http_user_agent]
27+
where = "token = '#hashedToken#' AND expiresAt > '#dateTimeFormat(now(), "yyyy-MM-dd HH:nn:ss")#' AND userAgent = '#cgi.http_user_agent#'"
2828
);
2929
3030
if (isObject(record)) {
31-
var user = model("User").findOne(where="id = ?", params=[record.userId], include="Role");
31+
var user = model("User").findOne(where="id = #val(record.userId)#", include="Role");
3232
if (isObject(user)) {
3333
// Rebuild session
3434
session.userID = user.id;
@@ -87,13 +87,13 @@ if (!structKeyExists(session, "userID") && structKeyExists(cookie, "remember_me"
8787
}
8888
}else{
8989
var record = model("RememberToken").findOne(
90-
where = "token = ?", params = [hashedToken],
90+
where = "token = '#hashedToken#'",
9191
includeSoftDeletes = true
9292
);
9393
if(isObject(record)){
9494
// Suspicious activity
9595
if (record.userAgent NEQ cgi.http_user_agent) {
96-
model("RememberToken").deleteAll(where="userId = ?", params=[record.userId]);
96+
model("RememberToken").deleteAll(where="userId = #val(record.userId)#");
9797
9898
model("Log").log(
9999
category = "wheels.auth",
@@ -107,7 +107,7 @@ if (!structKeyExists(session, "userID") && structKeyExists(cookie, "remember_me"
107107
);
108108
}else{
109109
// Expired attempt
110-
model("RememberToken").deleteAll(where="userId = ?", params=[record.userId]);
110+
model("RememberToken").deleteAll(where="userId = #val(record.userId)#");
111111
model("Log").log(
112112
category = "wheels.auth",
113113
level = "WARN",

app/models/LoginAttempt.cfc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@ component extends="app.Models.Model" {
5151
// Check if user is locked out (either by failed attempts or admin lock)
5252
public function isUserLocked(required string email) {
5353
// First check if user is manually locked by admin
54-
var user = model("User").findOne(where="email = ?", params=[arguments.email]);
54+
var user = model("User").findOne(where="email = '#arguments.email#'");
5555
if (!isNull(user) && user.locked) {
5656
return true;
5757
}
5858

5959
// Check for automatic lock due to failed attempts within the last 15 minutes
6060
var cutoff = dateAdd("n", -15, now());
6161
var attempts = findAll(
62-
where="email = ? AND createdAt > ?", params=[arguments.email, cutoff]
62+
where="email = '#arguments.email#' AND createdAt > '#dateTimeFormat(cutoff, "yyyy-MM-dd HH:nn:ss")#'"
6363
);
6464
return attempts.recordCount >= 3;
6565
}
@@ -68,7 +68,7 @@ component extends="app.Models.Model" {
6868
public function getRemainingAttempts(required string email) {
6969
var cutoff = dateAdd("n", -15, now());
7070
var attempts = findAll(
71-
where="email = ? AND createdAt > ?", params=[arguments.email, cutoff]
71+
where="email = '#arguments.email#' AND createdAt > '#dateTimeFormat(cutoff, "yyyy-MM-dd HH:nn:ss")#'"
7272
);
7373
return 3 - attempts.recordCount;
7474
}
@@ -83,6 +83,6 @@ component extends="app.Models.Model" {
8383

8484
// Clear failed attempts for a user
8585
public function clearFailedAttempts(required string email) {
86-
return deleteAll(where="email = ?", params=[arguments.email]);
86+
return deleteAll(where="email = '#arguments.email#'");
8787
}
8888
}

app/models/PasswordReset.cfc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ component extends="app.Models.Model" {
1919
// Find active reset token
2020
public function findActiveToken(required string token) {
2121
return findOne(
22-
where="token = ? AND expires_at > ? AND used = 0", params=[arguments.token, now()]
22+
where="token = '#arguments.token#' AND expiresAt > '#dateTimeFormat(now(), "yyyy-MM-dd HH:nn:ss")#' AND used = 0"
2323
);
2424
}
2525

app/models/RememberToken.cfc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ component extends="app.Models.Model" {
7575
// Find token by value
7676
public function findByToken(required string token) {
7777
return findOne(
78-
where="token = ? AND expires_at > ?", params=[arguments.token, now()]
78+
where="token = '#arguments.token#' AND expiresAt > '#dateTimeFormat(now(), "yyyy-MM-dd HH:nn:ss")#'"
7979
);
8080
}
8181

8282
// Delete expired tokens
8383
public function deleteExpiredTokens() {
84-
return deleteAll(where="expires_at <= ?", params=[now()]);
84+
return deleteAll(where="expiresAt <= '#dateTimeFormat(now(), "yyyy-MM-dd HH:nn:ss")#'");
8585
}
8686
}

app/models/User.cfc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ component extends="app.Models.Model" {
216216

217217
// Check if user has submitted a testimonial
218218
public function hasSubmittedTestimonial() {
219-
testimonial = model("Testimonial").findOne(where="userId = ?", params=[this.id]);
219+
testimonial = model("Testimonial").findOne(where="userId = #val(this.id)#");
220220
return IsObject(testimonial);
221221
}
222222

app/views/admin/AdminController/blog.cfm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
<cfscript>
5252
var categories = model("BlogCategory").findAll(
5353
select = "name",
54-
where = "blogId = ?", params=[blogs.id[i]],
54+
where = "blogId = #val(blogs.id[i])#",
5555
include = "Blog,Category"
5656
);
5757
var categoryNames = valueList(categories.name);

app/views/admin/AdminController/comments.cfm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#left(comments.content[j], 30)#
3030
</a></td>
3131
<td>
32-
<cfset parentComment= model("comment").findAll(select="content", where="id = ?", params=[comments.commentParentId[j]])>
32+
<cfset parentComment= model("comment").findAll(select="content", where="id = #val(comments.commentParentId[j])#")>
3333
#left(parentComment.content, 30)#
3434
</td>
3535
<td>#comments.FullName[j]#</td>

app/views/admin/AdminController/partials/_blogs.cfm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
<cfscript>
4949
var categories = model("BlogCategory").findAll(
5050
select = "name",
51-
where = "blogId = ?", params=[blogs.id[i]],
51+
where = "blogId = #val(blogs.id[i])#",
5252
include = "Blog,Category"
5353
);
5454
var categoryNames = valueList(categories.name);

app/views/admin/AdminController/partials/_commentView.cfm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<tr>
1515
<th>Parent comment:</th>
1616
<td>
17-
<cfset parentComment= model("comment").findAll(select="content", where="id = ?", params=[comments.commentparentId])>
17+
<cfset parentComment= model("comment").findAll(select="content", where="id = #val(comments.commentparentId)#")>
1818
#left(parentComment.content, 30)#
1919
</td>
2020
</tr>

0 commit comments

Comments
 (0)