Toggle navigation
Toggle navigation
This project
Loading...
Sign in
김대철
/
CafeRecommend
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
최정민
2021-05-11 07:15:45 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
20b74c414ddf6af9e2ac4fcbd3f9b180de9fe8d8
20b74c41
1 parent
3762470f
FEAT : 2차로그인 기능추가
session-file-store를 이용하여 회원가입 진행 -
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
197 additions
and
4 deletions
package-lock.json
package.json
routes/index.js
sessions/MEbzXm6yVZ3x71k39o7JtR0-SirVibPV.json
views/login.ejs
package-lock.json
View file @
20b74c4
...
...
@@ -62,11 +62,27 @@
"resolved"
:
"https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz"
,
"integrity"
:
"sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug=="
},
"asn1.js"
:
{
"version"
:
"5.4.1"
,
"resolved"
:
"https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz"
,
"integrity"
:
"sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA=="
,
"requires"
:
{
"bn.js"
:
"^4.0.0"
,
"inherits"
:
"^2.0.1"
,
"minimalistic-assert"
:
"^1.0.0"
,
"safer-buffer"
:
"^2.1.0"
}
},
"async"
:
{
"version"
:
"0.9.2"
,
"resolved"
:
"https://registry.npmjs.org/async/-/async-0.9.2.tgz"
,
"integrity"
:
"sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0="
},
"bagpipe"
:
{
"version"
:
"0.3.5"
,
"resolved"
:
"https://registry.npmjs.org/bagpipe/-/bagpipe-0.3.5.tgz"
,
"integrity"
:
"sha1-40HRZPyyTN8E6n4Ft2XsEMiupqE="
},
"balanced-match"
:
{
"version"
:
"1.0.2"
,
"resolved"
:
"https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz"
,
...
...
@@ -90,6 +106,11 @@
"resolved"
:
"https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.1.tgz"
,
"integrity"
:
"sha512-IdZR9mh6ahOBv/hYGiXyVuyCetmGJhtYkqLBpTStdhEGjegpPlUawydyaF3pbIOFynJTpllEs+NP+CS9jKFLjA=="
},
"bn.js"
:
{
"version"
:
"4.12.0"
,
"resolved"
:
"https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz"
,
"integrity"
:
"sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA=="
},
"body-parser"
:
{
"version"
:
"1.18.3"
,
"resolved"
:
"https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz"
,
...
...
@@ -291,6 +312,33 @@
}
}
},
"express-session"
:
{
"version"
:
"1.17.1"
,
"resolved"
:
"https://registry.npmjs.org/express-session/-/express-session-1.17.1.tgz"
,
"integrity"
:
"sha512-UbHwgqjxQZJiWRTMyhvWGvjBQduGCSBDhhZXYenziMFjxst5rMV+aJZ6hKPHZnPyHGsrqRICxtX8jtEbm/z36Q=="
,
"requires"
:
{
"cookie"
:
"0.4.0"
,
"cookie-signature"
:
"1.0.6"
,
"debug"
:
"2.6.9"
,
"depd"
:
"~2.0.0"
,
"on-headers"
:
"~1.0.2"
,
"parseurl"
:
"~1.3.3"
,
"safe-buffer"
:
"5.2.0"
,
"uid-safe"
:
"~2.1.5"
},
"dependencies"
:
{
"depd"
:
{
"version"
:
"2.0.0"
,
"resolved"
:
"https://registry.npmjs.org/depd/-/depd-2.0.0.tgz"
,
"integrity"
:
"sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw=="
},
"safe-buffer"
:
{
"version"
:
"5.2.0"
,
"resolved"
:
"https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz"
,
"integrity"
:
"sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg=="
}
}
},
"extend"
:
{
"version"
:
"3.0.2"
,
"resolved"
:
"https://registry.npmjs.org/extend/-/extend-3.0.2.tgz"
,
...
...
@@ -333,6 +381,16 @@
"resolved"
:
"https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz"
,
"integrity"
:
"sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
},
"fs-extra"
:
{
"version"
:
"8.1.0"
,
"resolved"
:
"https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz"
,
"integrity"
:
"sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g=="
,
"requires"
:
{
"graceful-fs"
:
"^4.2.0"
,
"jsonfile"
:
"^4.0.0"
,
"universalify"
:
"^0.1.0"
}
},
"gaxios"
:
{
"version"
:
"4.2.1"
,
"resolved"
:
"https://registry.npmjs.org/gaxios/-/gaxios-4.2.1.tgz"
,
...
...
@@ -378,6 +436,11 @@
"node-forge"
:
"^0.10.0"
}
},
"graceful-fs"
:
{
"version"
:
"4.2.6"
,
"resolved"
:
"https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz"
,
"integrity"
:
"sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ=="
},
"gtoken"
:
{
"version"
:
"5.2.1"
,
"resolved"
:
"https://registry.npmjs.org/gtoken/-/gtoken-5.2.1.tgz"
,
...
...
@@ -436,6 +499,11 @@
"safer-buffer"
:
">= 2.1.2 < 3"
}
},
"imurmurhash"
:
{
"version"
:
"0.1.4"
,
"resolved"
:
"https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz"
,
"integrity"
:
"sha1-khi5srkoojixPcT7a21XbyMUU+o="
},
"inherits"
:
{
"version"
:
"2.0.3"
,
"resolved"
:
"https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz"
,
...
...
@@ -451,6 +519,11 @@
"resolved"
:
"https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz"
,
"integrity"
:
"sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw=="
},
"is-typedarray"
:
{
"version"
:
"1.0.0"
,
"resolved"
:
"https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz"
,
"integrity"
:
"sha1-5HnICFjfDBsR3dppQPlgEfzaSpo="
},
"jake"
:
{
"version"
:
"10.8.2"
,
"resolved"
:
"https://registry.npmjs.org/jake/-/jake-10.8.2.tgz"
,
...
...
@@ -470,6 +543,14 @@
"bignumber.js"
:
"^9.0.0"
}
},
"jsonfile"
:
{
"version"
:
"4.0.0"
,
"resolved"
:
"https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz"
,
"integrity"
:
"sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss="
,
"requires"
:
{
"graceful-fs"
:
"^4.1.6"
}
},
"jwa"
:
{
"version"
:
"2.0.0"
,
"resolved"
:
"https://registry.npmjs.org/jwa/-/jwa-2.0.0.tgz"
,
...
...
@@ -489,6 +570,14 @@
"safe-buffer"
:
"^5.0.1"
}
},
"kruptein"
:
{
"version"
:
"2.2.3"
,
"resolved"
:
"https://registry.npmjs.org/kruptein/-/kruptein-2.2.3.tgz"
,
"integrity"
:
"sha512-BTwprBPTzkFT9oTugxKd3WnWrX630MqUDsnmBuoa98eQs12oD4n4TeI0GbpdGcYn/73Xueg2rfnw+oK4dovnJg=="
,
"requires"
:
{
"asn1.js"
:
"^5.4.1"
}
},
"lru-cache"
:
{
"version"
:
"6.0.0"
,
"resolved"
:
"https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz"
,
...
...
@@ -530,6 +619,11 @@
"mime-db"
:
"1.47.0"
}
},
"minimalistic-assert"
:
{
"version"
:
"1.0.1"
,
"resolved"
:
"https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz"
,
"integrity"
:
"sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A=="
},
"minimatch"
:
{
"version"
:
"3.0.4"
,
"resolved"
:
"https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz"
,
...
...
@@ -570,6 +664,11 @@
"resolved"
:
"https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz"
,
"integrity"
:
"sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA=="
},
"object-assign"
:
{
"version"
:
"4.1.1"
,
"resolved"
:
"https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz"
,
"integrity"
:
"sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM="
},
"on-finished"
:
{
"version"
:
"2.3.0"
,
"resolved"
:
"https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz"
,
...
...
@@ -607,6 +706,11 @@
"resolved"
:
"https://registry.npmjs.org/qs/-/qs-6.5.2.tgz"
,
"integrity"
:
"sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA=="
},
"random-bytes"
:
{
"version"
:
"1.0.0"
,
"resolved"
:
"https://registry.npmjs.org/random-bytes/-/random-bytes-1.0.0.tgz"
,
"integrity"
:
"sha1-T2ih3Arli9P7lYSMMDJNt11kNgs="
},
"range-parser"
:
{
"version"
:
"1.2.1"
,
"resolved"
:
"https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz"
,
...
...
@@ -623,6 +727,11 @@
"unpipe"
:
"1.0.0"
}
},
"retry"
:
{
"version"
:
"0.12.0"
,
"resolved"
:
"https://registry.npmjs.org/retry/-/retry-0.12.0.tgz"
,
"integrity"
:
"sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs="
},
"safe-buffer"
:
{
"version"
:
"5.1.2"
,
"resolved"
:
"https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz"
,
...
...
@@ -664,11 +773,29 @@
"send"
:
"0.16.2"
}
},
"session-file-store"
:
{
"version"
:
"1.5.0"
,
"resolved"
:
"https://registry.npmjs.org/session-file-store/-/session-file-store-1.5.0.tgz"
,
"integrity"
:
"sha512-60IZaJNzyu2tIeHutkYE8RiXVx3KRvacOxfLr2Mj92SIsRIroDsH0IlUUR6fJAjoTW4RQISbaOApa2IZpIwFdQ=="
,
"requires"
:
{
"bagpipe"
:
"^0.3.5"
,
"fs-extra"
:
"^8.0.1"
,
"kruptein"
:
"^2.0.4"
,
"object-assign"
:
"^4.1.1"
,
"retry"
:
"^0.12.0"
,
"write-file-atomic"
:
"3.0.3"
}
},
"setprototypeof"
:
{
"version"
:
"1.1.0"
,
"resolved"
:
"https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz"
,
"integrity"
:
"sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ=="
},
"signal-exit"
:
{
"version"
:
"3.0.3"
,
"resolved"
:
"https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz"
,
"integrity"
:
"sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA=="
},
"statuses"
:
{
"version"
:
"1.4.0"
,
"resolved"
:
"https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz"
,
...
...
@@ -691,6 +818,27 @@
"mime-types"
:
"~2.1.24"
}
},
"typedarray-to-buffer"
:
{
"version"
:
"3.1.5"
,
"resolved"
:
"https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz"
,
"integrity"
:
"sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q=="
,
"requires"
:
{
"is-typedarray"
:
"^1.0.0"
}
},
"uid-safe"
:
{
"version"
:
"2.1.5"
,
"resolved"
:
"https://registry.npmjs.org/uid-safe/-/uid-safe-2.1.5.tgz"
,
"integrity"
:
"sha512-KPHm4VL5dDXKz01UuEd88Df+KzynaohSL9fBh096KWAxSKZQDI2uBrVqtvRM4rwrIrRRKsdLNML/lnaaVSRioA=="
,
"requires"
:
{
"random-bytes"
:
"~1.0.0"
}
},
"universalify"
:
{
"version"
:
"0.1.2"
,
"resolved"
:
"https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz"
,
"integrity"
:
"sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg=="
},
"unpipe"
:
{
"version"
:
"1.0.0"
,
"resolved"
:
"https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz"
,
...
...
@@ -706,6 +854,17 @@
"resolved"
:
"https://registry.npmjs.org/vary/-/vary-1.1.2.tgz"
,
"integrity"
:
"sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
},
"write-file-atomic"
:
{
"version"
:
"3.0.3"
,
"resolved"
:
"https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz"
,
"integrity"
:
"sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q=="
,
"requires"
:
{
"imurmurhash"
:
"^0.1.4"
,
"is-typedarray"
:
"^1.0.0"
,
"signal-exit"
:
"^3.0.2"
,
"typedarray-to-buffer"
:
"^3.1.5"
}
},
"yallist"
:
{
"version"
:
"4.0.0"
,
"resolved"
:
"https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz"
,
...
...
package.json
View file @
20b74c4
...
...
@@ -10,8 +10,10 @@
"debug"
:
"~2.6.9"
,
"ejs"
:
"^3.1.6"
,
"express"
:
"^4.16.4"
,
"express-session"
:
"^1.17.1"
,
"google-auth-library"
:
"^7.0.4"
,
"http-errors"
:
"~1.6.3"
,
"morgan"
:
"~1.9.1"
"morgan"
:
"~1.9.1"
,
"session-file-store"
:
"^1.5.0"
}
}
...
...
routes/index.js
View file @
20b74c4
...
...
@@ -3,6 +3,14 @@ var router = express.Router();
var
{
OAuth2Client
}
=
require
(
'google-auth-library'
);
var
CLIENT_ID
=
"94679084723-s5f0686p2porp9mkakrp1p89a48n24nj.apps.googleusercontent.com"
var
client
=
new
OAuth2Client
(
CLIENT_ID
);
var
session
=
require
(
'express-session'
);
var
FileStore
=
require
(
'session-file-store'
)(
session
);
router
.
use
(
session
({
secret
:
'209'
,
// 암호화
resave
:
false
,
saveUninitialized
:
true
,
store
:
new
FileStore
()
}))
/* GET home page. */
router
.
get
(
'/'
,
function
(
req
,
res
,
next
)
{
...
...
@@ -30,7 +38,16 @@ router.post('/index', (req, res) => {
router
.
get
(
'/login'
,
checkAuthenticated
,
(
req
,
res
)
=>
{
let
user
=
req
.
user
;
res
.
render
(
'login'
,
{
user
})
req
.
session
.
user
=
user
;
res
.
render
(
'login'
,
{
user
:
req
.
session
.
user
})
});
router
.
post
(
'/login'
,(
req
,
res
)
=>
{
console
.
log
(
req
.
body
.
nickname
);
console
.
log
(
req
.
body
.
age
);
console
.
log
(
req
.
body
.
gender
);
return
res
.
render
(
'login'
,
{
user
:
req
.
session
.
user
})
});
module
.
exports
=
router
;
...
...
@@ -58,7 +75,7 @@ function checkAuthenticated(req, res, next){
next
();
})
.
catch
(
err
=>
{
res
.
redirect
(
'/
login
'
)
res
.
redirect
(
'/
index
'
)
})
}
\ No newline at end of file
...
...
sessions/MEbzXm6yVZ3x71k39o7JtR0-SirVibPV.json
0 → 100644
View file @
20b74c4
{
"cookie"
:{
"originalMaxAge"
:
null
,
"expires"
:
null
,
"httpOnly"
:
true
,
"path"
:
"/"
},
"__lastAccess"
:
1620684562564
,
"user"
:{
"name"
:
"최정민[학생](소프트웨어융합대학 컴퓨터공학과)"
,
"email"
:
"cjm2021401@khu.ac.kr"
,
"picture"
:
"https://lh3.googleusercontent.com/a/AATXAJzFD3R6CaL2NpysVrfvdGqcQ83vh_wpbN_5hj-0=s96-c"
}}
\ No newline at end of file
views/login.ejs
View file @
20b74c4
...
...
@@ -8,8 +8,22 @@
</head>
<body>
<a
href=
"/index"
onclick=
"signOut();"
>
Sign Out
</a>
<h1>
Hi
<
%= user.name %>
</h1>
<form
method=
"post"
>
NickName:
<br>
<input
type=
"text"
name=
"nickname"
value=
"MickeyMouse"
><br>
Age:
<br>
<input
type=
"text"
name=
"age"
value=
"19"
><br><br>
<input
type=
"radio"
id=
"male"
name=
"gender"
value=
"male"
>
<label
for=
"male"
>
Male
</label><br>
<input
type=
"radio"
id=
"female"
name=
"gender"
value=
"female"
>
<label
for=
"female"
>
Female
</label><br>
<input
type=
"submit"
value=
"Submit"
>
</form>
<a
href=
"/index"
onclick=
"signOut();"
>
Sign Out
</a>
</body>
<script>
...
...
Please
register
or
login
to post a comment