fix(auth): Always update password hash for existing users in seed

This commit is contained in:
fullsizemalt 2026-01-08 02:07:49 -08:00
parent 7386b5c6c5
commit c7d1bfeb99

View file

@ -64,16 +64,18 @@ async function main() {
rate: 100.00 rate: 100.00
} }
}); });
console.log('Created Owner: Travis (admin@runfoo.com)'); console.log('Created Owner: Travis (admin@runfoo.run)');
} else { } else {
// Update existing owner to have roleId if missing // Always ensure password is properly hashed and role is set
if (!existingOwner.roleId && ownerRole) { await prisma.user.update({
await prisma.user.update({ where: { email: ownerEmail },
where: { email: ownerEmail }, data: {
data: { roleId: ownerRole.id, name: 'Travis' } passwordHash: await bcrypt.hash('password123', 10),
}); roleId: ownerRole?.id || existingOwner.roleId,
console.log('Updated Owner permissions'); name: 'Travis'
} }
});
console.log('Updated Owner password hash');
} }
// Create Default Supplies // Create Default Supplies