mirror of
https://github.com/BreizhHardware/Site-comptage-heure.git
synced 2026-01-18 16:17:28 +01:00
feat: Add bulk import from ISEN excel
This commit is contained in:
30
scripts/fix-imported-passwords.js
Normal file
30
scripts/fix-imported-passwords.js
Normal file
@@ -0,0 +1,30 @@
|
||||
const { PrismaClient } = require('@prisma/client');
|
||||
const bcrypt = require('bcryptjs');
|
||||
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
async function main() {
|
||||
console.log('Updating passwords for users requiring reset...');
|
||||
|
||||
const hashedPassword = await bcrypt.hash('123456', 10);
|
||||
|
||||
const result = await prisma.user.updateMany({
|
||||
where: {
|
||||
passwordResetRequired: true,
|
||||
},
|
||||
data: {
|
||||
password: hashedPassword,
|
||||
},
|
||||
});
|
||||
|
||||
console.log(`Updated ${result.count} users with temporary password "123456"`);
|
||||
}
|
||||
|
||||
main()
|
||||
.catch((e) => {
|
||||
console.error(e);
|
||||
process.exit(1);
|
||||
})
|
||||
.finally(async () => {
|
||||
await prisma.$disconnect();
|
||||
});
|
||||
Reference in New Issue
Block a user