Change to synchronous password hashing.

This commit is contained in:
Mike Cao 2021-05-23 17:29:27 -07:00
parent 756beb2cf5
commit b2d04c00ac
5 changed files with 12 additions and 12 deletions

View file

@ -1,14 +1,14 @@
const bcrypt = require('bcrypt');
const bcrypt = require('bcryptjs');
const { PrismaClient } = require('@prisma/client');
const prisma = new PrismaClient();
const SALT_ROUNDS = 10;
const hashPassword = password => {
return bcrypt.hash(password, SALT_ROUNDS);
return bcrypt.hashSync(password, SALT_ROUNDS);
};
async function main() {
const password = await hashPassword(process.env.ADMIN_PASSWORD || 'umami');
const password = hashPassword(process.env.ADMIN_PASSWORD || 'umami');
await prisma.account.upsert({
where: { username: 'admin' },
update: {},