const bcrypt = require("bcrypt"); const { query } = require("./db"); const users = [ { username: "hop", password: "hopmusic2025" }, { username: "kristen", password: "kristen2025" }, { username: "camilah", password: "camilah2025" }, { username: "worship-leader", password: "worship2025" }, ]; async function updatePasswords() { console.log("šŸ” Updating user passwords with bcrypt hashes...\n"); for (const user of users) { try { // Generate bcrypt hash const hash = await bcrypt.hash(user.password, 10); // Update in database await query( "UPDATE users SET password_hash = $1 WHERE LOWER(username) = LOWER($2)", [hash, user.username], ); console.log(`āœ… Updated password for: ${user.username}`); } catch (err) { console.error(`āŒ Failed to update ${user.username}:`, err.message); } } console.log("\n✨ Password update complete!"); process.exit(0); } updatePasswords().catch((err) => { console.error("Error:", err); process.exit(1); });