Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-1-capstone-design1
/
Triz_Project1
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
1
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
sdy
2020-04-23 22:43:20 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ca6053cae84d026180df48d497f41bc075047765
ca6053ca
1 parent
86d48b55
add bcrypt
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletions
back/src/api/User/requestEmailSecret/requestEmailSecret.js
back/src/api/User/requestEmailSecret/requestEmailSecret.js
View file @
ca6053c
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
;
...
...
Please
register
or
login
to post a comment