Toggle navigation
Toggle navigation
This project
Loading...
Sign in
서민정
/
SEARCH-AND-CHAT
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
2
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
서민정
2020-06-03 16:56:49 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
949a1c1b24e8ca150593a77105be26439ad6e9aa
949a1c1b
1 parent
06f386a2
update login function but need to modify git add .!
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
46 additions
and
6 deletions
client/src/views/loginpage.js
index.js
server/routes/dialogflow.js
server/routes/latest.js
server/routes/news.js
server/routes/related.js
server/routes/users/login.js
client/src/views/loginpage.js
View file @
949a1c1
import
React
from
"react"
;
import
{
Typography
,
Form
,
Input
,
Icon
,
Button
}
from
'antd'
;
import
{
withRouter
}
from
"react-router-dom"
;
import
Axios
from
'axios'
;
const
{
Title
}
=
Typography
;
const
email
=
document
.
getElementById
(
'email'
);
const
pw
=
document
.
getElementById
(
'password'
);
async
function
login
()
{
var
LoginForm
=
document
.
loginForm
;
if
(
email
&&
pw
){
const
info
=
{
email
,
pw
}
const
response
=
await
Axios
.
post
(
'/users/login'
,
info
)
if
(
response
){
LoginForm
.
action
=
`/chat?
${
response
}
`
;
LoginForm
.
loginForm
.
submit
();
}
}
}
function
loginpage
()
{
return
(
<
div
>
<
div
style
=
{{
display
:
'flex'
,
justifyContent
:
'center'
,
marginTop
:
'1rem'
,
paddingTop
:
'10rem'
}}
>
<
Title
level
=
{
2
}
>
Login
Page
<
/Title
>
<
/div
>
<
div
style
=
{{
display
:
'flex'
,
justifyContent
:
'center'
,
marginTop
:
'1rem'
}}
>
<
form
style
=
{{
width
:
'350px'
}}
>
<
form
style
=
{{
width
:
'350px'
}}
name
=
"loginForm"
>
<
Form
.
Item
required
>
<
Input
id
=
"email"
...
...
@@ -32,7 +54,7 @@ function loginpage() {
<
Form
.
Item
>
<
div
>
<
Button
type
=
"primary"
htmlType
=
"submit"
className
=
"login-form-button"
style
=
{{
minWidth
:
'100%'
}}
>
<
Button
type
=
"primary"
htmlType
=
"submit"
className
=
"login-form-button"
style
=
{{
minWidth
:
'100%'
}}
onClick
=
{
login
}
>
Log
in
<
/Button
>
<
/div
>
...
...
index.js
View file @
949a1c1
...
...
@@ -8,6 +8,7 @@ const config = require("./server/config/keys");
app
.
use
(
bodyParser
.
urlencoded
({
extended
:
true
}));
app
.
use
(
bodyParser
.
json
());
app
.
use
(
'/users/login'
,
require
(
'./server/routes/users/login'
));
app
.
use
(
'/api/dialogflow'
,
require
(
'./server/routes/dialogflow'
));
app
.
use
(
'/api/latest'
,
require
(
'./server/routes/latest'
));
app
.
use
(
'/api/related'
,
require
(
'./server/routes/related'
));
...
...
server/routes/dialogflow.js
View file @
949a1c1
...
...
@@ -2,7 +2,6 @@ const express = require('express');
const
router
=
express
.
Router
();
const
structjson
=
require
(
'./structjson.js'
);
const
dialogflow
=
require
(
'dialogflow'
);
const
uuid
=
require
(
'uuid'
);
const
config
=
require
(
'../config/keys'
);
...
...
server/routes/latest.js
View file @
949a1c1
const
express
=
require
(
'express'
);
const
router
=
express
.
Router
();
const
uuid
=
require
(
'uuid'
);
//uuid 제대로 이해하고 다시 작성하기.
const
axios
=
require
(
'axios'
);
const
cheerio
=
require
(
'cheerio'
);
...
...
server/routes/news.js
View file @
949a1c1
const
express
=
require
(
'express'
);
const
router
=
express
.
Router
();
const
uuid
=
require
(
'uuid'
);
//uuid 제대로 이해하고 다시 작성하기.
const
axios
=
require
(
'axios'
);
const
cheerio
=
require
(
'cheerio'
);
...
...
server/routes/related.js
View file @
949a1c1
const
express
=
require
(
'express'
);
const
router
=
express
.
Router
();
const
uuid
=
require
(
'uuid'
);
//uuid 제대로 이해하고 다시 작성하기.
const
axios
=
require
(
'axios'
);
const
cheerio
=
require
(
'cheerio'
);
...
...
server/routes/users/login.js
View file @
949a1c1
const
express
=
require
(
'express'
);
const
router
=
express
.
Router
();
var
user
=
{
email
:
"mathmjseo@khu.ac.kr"
,
name
:
"minjeong"
,
pw
:
"1234"
,
keyword
:
"오마이걸"
}
router
.
post
(
'/users/login'
,
async
(
req
,
res
)
=>
{
const
userEmail
=
req
.
body
.
email
;
const
userPW
=
req
.
body
.
pw
;
const
data
=
""
;
if
(
userEmail
===
user
.
email
&&
ueserPW
===
user
.
pw
){
data
=
user
.
keyword
;
}
res
.
send
(
data
);
})
module
.
exports
=
router
;
\ No newline at end of file
...
...
Please
register
or
login
to post a comment