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-25 00:59:35 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
9b3054abbea721e82afb776bdfa036b26289fe89
9b3054ab
1 parent
cbcbf386
create new middleware
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
0 deletions
back/src/utils.js
back/src/utils.js
View file @
9b3054a
...
...
@@ -16,6 +16,13 @@ export const getUserId = (context) => {
throw
new
Error
(
"There is no vaild user"
);
};
export
const
isAuthenticated
=
(
request
)
=>
{
if
(
!
request
.
user
)
{
throw
new
Error
(
"You need to login First"
);
}
return
;
};
export
const
generateSecret
=
()
=>
{
const
randomNumber
=
Math
.
floor
(
Math
.
random
()
*
adjectives
.
length
);
return
`
${
adjectives
[
randomNumber
]}
${
nouns
[
randomNumber
]}
`
;
...
...
Please
register
or
login
to post a comment