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 21:49:49 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
2bdfe8115e3154b4cd23fcb8b4da5c277d3525ed
2bdfe811
1 parent
dbb4c19b
update confirmEmailSecret
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
0 deletions
back/src/api/User/confirmEmailSecret/confirmEmailSecret.graphql
back/src/api/User/confirmEmailSecret/confirmEmailSecret.js
back/src/api/User/confirmEmailSecret/confirmEmailSecret.graphql
0 → 100644
View file @
2bdfe81
type Mutation {
confirmEmailSecret(secret: String!, email: String!): String!
}
back/src/api/User/confirmEmailSecret/confirmEmailSecret.js
0 → 100644
View file @
2bdfe81
import
{
prisma
,
generateToken
}
from
"../../../utils"
;
export
default
{
Mutation
:
{
confirmEmailSecret
:
async
(
_
,
args
)
=>
{
const
{
secret
,
email
}
=
args
;
const
user
=
await
prisma
.
user
.
findOne
({
where
:
{
email
,
},
});
if
(
user
.
emailSecret
!==
secret
)
{
throw
new
Error
(
"not vaild secret value!, input another value or resend email"
);
}
else
{
// TODO: Update emailSecret in prisma
await
prisma
.
user
.
update
({
where
:
{
email
,
},
data
:
{
emailSecret
:
""
,
},
});
return
generateToken
(
user
.
id
);
}
},
},
};
Please
register
or
login
to post a comment