Showing
1 changed file
with
3 additions
and
1 deletions
1 | import { prisma, isAuthenticated } from "../../../utils"; | 1 | import { prisma, isAuthenticated } from "../../../utils"; |
2 | +import bcrypt from "bcryptjs"; | ||
2 | 3 | ||
3 | export default { | 4 | export default { |
4 | Mutation: { | 5 | Mutation: { |
... | @@ -19,13 +20,14 @@ export default { | ... | @@ -19,13 +20,14 @@ export default { |
19 | // For check new password is right, the two things must be same. | 20 | // For check new password is right, the two things must be same. |
20 | throw new Error("the two password don't match each other, try again"); | 21 | throw new Error("the two password don't match each other, try again"); |
21 | } else { | 22 | } else { |
23 | + const encyptPW = await bcrypt.hash(passwordOne, 10); | ||
22 | await prisma.user.update({ | 24 | await prisma.user.update({ |
23 | where: { | 25 | where: { |
24 | email, | 26 | email, |
25 | }, | 27 | }, |
26 | data: { | 28 | data: { |
27 | emailSecret: "", | 29 | emailSecret: "", |
28 | - password: passwordOne, | 30 | + password: encyptPW, |
29 | }, | 31 | }, |
30 | }); | 32 | }); |
31 | } | 33 | } | ... | ... |
-
Please register or login to post a comment