From bc88f28e60e8adaafc36db0c6541909eebf6487d Mon Sep 17 00:00:00 2001 From: John Mizerek Date: Fri, 30 Jan 2026 17:15:46 -0800 Subject: [PATCH] Fix UserID column references in auth endpoints after schema normalization Users table primary key was renamed from UserID to ID but these endpoints still referenced the old column name, causing server_error on login/signup OTP flow. Co-Authored-By: Claude Opus 4.5 --- api/auth/completeProfile.cfm | 2 +- api/auth/loginOTP.cfm | 4 ++-- api/auth/profile.cfm | 2 +- api/auth/sendOTP.cfm | 4 ++-- api/auth/verifyLoginOTP.cfm | 2 +- api/auth/verifyOTP.cfm | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/auth/completeProfile.cfm b/api/auth/completeProfile.cfm index 0ab846f..26a655e 100644 --- a/api/auth/completeProfile.cfm +++ b/api/auth/completeProfile.cfm @@ -100,7 +100,7 @@ try { IsEmailVerified = 0, IsContactVerified = 1, IsActive = 1 - WHERE UserID = :userId + WHERE ID = :userId ", { firstName: { value: firstName, cfsqltype: "cf_sql_varchar" }, lastName: { value: lastName, cfsqltype: "cf_sql_varchar" }, diff --git a/api/auth/loginOTP.cfm b/api/auth/loginOTP.cfm index 3175285..09d3fe1 100644 --- a/api/auth/loginOTP.cfm +++ b/api/auth/loginOTP.cfm @@ -69,7 +69,7 @@ try { if (!len(trim(userUUID))) { userUUID = replace(createUUID(), "-", "", "all"); queryExecute(" - UPDATE Users SET UUID = :uuid WHERE UserID = :userId + UPDATE Users SET UUID = :uuid WHERE ID = :userId ", { uuid: { value: userUUID, cfsqltype: "cf_sql_varchar" }, userId: { value: qUser.ID, cfsqltype: "cf_sql_integer" } @@ -81,7 +81,7 @@ try { queryExecute(" UPDATE Users SET MobileVerifyCode = :otp - WHERE UserID = :userId + WHERE ID = :userId ", { otp: { value: otp, cfsqltype: "cf_sql_varchar" }, userId: { value: qUser.ID, cfsqltype: "cf_sql_integer" } diff --git a/api/auth/profile.cfm b/api/auth/profile.cfm index e4fa5cb..6ee50cc 100644 --- a/api/auth/profile.cfm +++ b/api/auth/profile.cfm @@ -127,7 +127,7 @@ if (cgi.REQUEST_METHOD == "POST") { queryExecute(" UPDATE Users SET #arrayToList(updates, ', ')# - WHERE UserID = :userId + WHERE ID = :userId ", params); // Return updated profile diff --git a/api/auth/sendOTP.cfm b/api/auth/sendOTP.cfm index b10e36c..0d33b57 100644 --- a/api/auth/sendOTP.cfm +++ b/api/auth/sendOTP.cfm @@ -91,10 +91,10 @@ try { SET MobileVerifyCode = :otp, IsContactVerified = 0, IsActive = 0 - WHERE UserID = :userId + WHERE ID = :userId ", { otp: { value: otp, cfsqltype: "cf_sql_varchar" }, - userId: { value: qIncomplete.UserID, cfsqltype: "cf_sql_integer" } + userId: { value: qIncomplete.ID, cfsqltype: "cf_sql_integer" } }, { datasource: "payfrit" }); } else { // Create new user record diff --git a/api/auth/verifyLoginOTP.cfm b/api/auth/verifyLoginOTP.cfm index df7082f..c6f83c4 100644 --- a/api/auth/verifyLoginOTP.cfm +++ b/api/auth/verifyLoginOTP.cfm @@ -85,7 +85,7 @@ try { queryExecute(" UPDATE Users SET MobileVerifyCode = '' - WHERE UserID = :userId + WHERE ID = :userId ", { userId: { value: qUser.ID, cfsqltype: "cf_sql_integer" } }, { datasource: "payfrit" }); // Create auth token diff --git a/api/auth/verifyOTP.cfm b/api/auth/verifyOTP.cfm index 47bed7c..8e11724 100644 --- a/api/auth/verifyOTP.cfm +++ b/api/auth/verifyOTP.cfm @@ -89,7 +89,7 @@ try { queryExecute(" UPDATE Users SET MobileVerifyCode = '' - WHERE UserID = :userId + WHERE ID = :userId ", { userId: { value: qUser.ID, cfsqltype: "cf_sql_integer" } }, { datasource: "payfrit" }); // Create auth token (needed for completeProfile call)