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
|
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
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue