sdy

update resetPassword

...@@ -4,7 +4,6 @@ import bcrypt from "bcryptjs"; ...@@ -4,7 +4,6 @@ import bcrypt from "bcryptjs";
4 export default { 4 export default {
5 Mutation: { 5 Mutation: {
6 resetPassword: async (_, args, { request }) => { 6 resetPassword: async (_, args, { request }) => {
7 - console.log(request);
8 isAuthenticated(request); 7 isAuthenticated(request);
9 const { emailSecret, email, passwordOne, passwordTwo } = args; 8 const { emailSecret, email, passwordOne, passwordTwo } = args;
10 const user = await prisma.user.findOne({ 9 const user = await prisma.user.findOne({
...@@ -12,8 +11,7 @@ export default { ...@@ -12,8 +11,7 @@ export default {
12 email, 11 email,
13 }, 12 },
14 }); 13 });
15 - const encryptSecret = await bcrypt.hash(user.emailSecret, 10); 14 + if (user.emailSecret !== emailSecret) {
16 - if (encryptSecret !== emailSecret) {
17 throw new Error( 15 throw new Error(
18 "not vaild secret value!, input another value or resend email" 16 "not vaild secret value!, input another value or resend email"
19 ); 17 );
......