sdy

add bcrypt

import { prisma, generateSecret, sendSecretMail } from "../../../utils";
import bcrypt from "bcryptjs";
export default {
Mutation: {
requestEmailSecret: async (_, args) => {
const { email } = args;
const emailSecret = generateSecret();
const encryptSecret = await bcrypt.hash(emailSecret, 10);
try {
await sendSecretMail(email, emailSecret);
await prisma.user.update({
......@@ -12,7 +14,7 @@ export default {
email,
},
data: {
emailSecret,
emailSecret: encryptSecret,
},
});
return true;
......