Initial commit: Club DynaSQY
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
const bcrypt = require('bcrypt');
|
||||
const mysql = require('mysql2/promise');
|
||||
require('dotenv').config();
|
||||
|
||||
const members = [
|
||||
{ email: 'pierre@dynabiz.fr', password: 'Pierre78@' },
|
||||
{ email: 'estelle@dynabiz.fr', password: 'Estelle78@' },
|
||||
{ email: 'patricia@dynabiz.fr', password: 'Patricia78@' },
|
||||
{ email: 'jennifer@dynabiz.fr', password: 'Jennifer78@' },
|
||||
{ email: 'amandine@dynabiz.fr', password: 'Amandine78@' },
|
||||
{ email: 'anais@dynabiz.fr', password: 'Anais78@' },
|
||||
{ email: 'bastien@dynabiz.fr', password: 'Bastien78@' },
|
||||
{ email: 'henrique@dynabiz.fr', password: 'Henrique78@' },
|
||||
{ email: 'laetitia@dynabiz.fr', password: 'Laetitia78@' },
|
||||
{ email: 'marie@dynabiz.fr', password: 'Marie78@' },
|
||||
{ email: 'miguel@dynabiz.fr', password: 'Miguel78@' },
|
||||
{ email: 'seb@dynabiz.fr', password: 'Seb78@' },
|
||||
{ email: 'christelle@dynabiz.fr', password: 'Christelle78@' },
|
||||
{ email: 'mathieu@dynabiz.fr', password: 'Mathieu78@' },
|
||||
{ email: 'morgane@dynabiz.fr', password: 'Morgane78@' },
|
||||
];
|
||||
|
||||
async function seed() {
|
||||
const connection = await mysql.createConnection({
|
||||
host: process.env.DB_HOST || 'localhost',
|
||||
port: parseInt(process.env.DB_PORT, 10) || 3306,
|
||||
user: process.env.DB_USER || 'dynausr',
|
||||
password: process.env.DB_PASSWORD || '',
|
||||
database: process.env.DB_NAME || 'dynasqy',
|
||||
});
|
||||
for (const m of members) {
|
||||
const hash = await bcrypt.hash(m.password, 10);
|
||||
await connection.execute('UPDATE users SET password_hash = ? WHERE email = ?', [hash, m.email]);
|
||||
}
|
||||
console.log('Mots de passe individuels crees !');
|
||||
for (const m of members) console.log(' ' + m.email.split('@')[0] + ' -> ' + m.password);
|
||||
await connection.end();
|
||||
}
|
||||
seed().catch(console.error);
|
||||
Reference in New Issue
Block a user