fix(auth): Always update password hash for existing users in seed
This commit is contained in:
parent
7386b5c6c5
commit
c7d1bfeb99
1 changed files with 11 additions and 9 deletions
|
|
@ -64,16 +64,18 @@ async function main() {
|
|||
rate: 100.00
|
||||
}
|
||||
});
|
||||
console.log('Created Owner: Travis (admin@runfoo.com)');
|
||||
console.log('Created Owner: Travis (admin@runfoo.run)');
|
||||
} else {
|
||||
// Update existing owner to have roleId if missing
|
||||
if (!existingOwner.roleId && ownerRole) {
|
||||
// Always ensure password is properly hashed and role is set
|
||||
await prisma.user.update({
|
||||
where: { email: ownerEmail },
|
||||
data: { roleId: ownerRole.id, name: 'Travis' }
|
||||
});
|
||||
console.log('Updated Owner permissions');
|
||||
data: {
|
||||
passwordHash: await bcrypt.hash('password123', 10),
|
||||
roleId: ownerRole?.id || existingOwner.roleId,
|
||||
name: 'Travis'
|
||||
}
|
||||
});
|
||||
console.log('Updated Owner password hash');
|
||||
}
|
||||
|
||||
// Create Default Supplies
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue