nodebil v2
This commit is contained in:
@@ -185,12 +185,12 @@ async function insertUser(username, passwordHash) {
|
||||
async function getUserId(username) {
|
||||
const query = `
|
||||
SELECT user_id, username AS dbUsername FROM Accounts
|
||||
WHERE LOWER(username) = $1;
|
||||
WHERE LOWER(username) = LOWER($1);
|
||||
`;
|
||||
try {
|
||||
const result = await client.query(query, [username]);
|
||||
if (result.rows.length > 0) {
|
||||
return result.rows[0];
|
||||
return result.rows[0].user_id;
|
||||
} else {
|
||||
console.log("No user found with username: ", username);
|
||||
return null;
|
||||
@@ -321,7 +321,7 @@ async function addMemberToGroupByUsername(conversation_id, username) {
|
||||
WITH user_id_query AS (
|
||||
SELECT user_id
|
||||
FROM Accounts
|
||||
WHERE LOWER(username) = $1
|
||||
WHERE LOWER(username) = LOWER($1)
|
||||
LIMIT 1
|
||||
),
|
||||
insert_membership AS (
|
||||
@@ -466,7 +466,7 @@ async function changePassword(username, newPasswordHash) {
|
||||
const query = `
|
||||
UPDATE Accounts
|
||||
SET password_hash = $1
|
||||
WHERE username = $2;
|
||||
WHERE LOWER(username) = LOWER($2);
|
||||
`;
|
||||
try {
|
||||
await client.query(query, [newPasswordHash, username]);
|
||||
|
||||
Reference in New Issue
Block a user