diff --git a/prisma/seed.ts b/prisma/seed.ts index 41e2d31..6e8de3d 100644 --- a/prisma/seed.ts +++ b/prisma/seed.ts @@ -1,4 +1,5 @@ import { fakerPT_BR as faker } from '@faker-js/faker' +import { hash } from 'bcryptjs' import { prisma } from '../src/lib/prisma' console.time('time') @@ -16,7 +17,7 @@ async function seed() { data: { email: 'admin@gmail.com', name: 'Admin', - password: 'dnx42697', + password: await hash('dnx42697', 10), role: 'ADMIN', }, }) @@ -29,7 +30,7 @@ async function seed() { data: { name: faker.person.fullName(), email: faker.internet.email(), - password: faker.internet.password(), + password: await hash(faker.internet.password(), 10), createdAt: faker.date.recent({ days: 40 }), updatedAt: faker.date.recent({ days: 30 }), }, diff --git a/src/app.ts b/src/app.ts index 48cbf3d..1da3e56 100644 --- a/src/app.ts +++ b/src/app.ts @@ -11,15 +11,12 @@ export const app = fastify() app.register(fastifyCors, { origin: (origin, cb) => { - const allowedOrigins = [ - 'http://localhost:5500', - 'https://mlkp1.github.io/Front2/', - ] + const allowedOrigins = ['http://localhost:5500', 'https://mlkp1.github.io'] if (!origin || allowedOrigins.includes(origin)) { cb(null, true) return } - cb(new Error('Not allowed'), false) + cb(new Error(`Not allowed from origin ${origin}`), false) }, credentials: true, methods: '*',