Mingyu

MySQL Login

...@@ -7,13 +7,15 @@ var bodyParser = require('body-parser') ...@@ -7,13 +7,15 @@ var bodyParser = require('body-parser')
7 var expressErrorHandler = require('express-error-handler'); 7 var expressErrorHandler = require('express-error-handler');
8 var indexRouter = require('./routes/index') 8 var indexRouter = require('./routes/index')
9 var loginRouter = require('./routes/login') 9 var loginRouter = require('./routes/login')
10 -var sign_upRouter = require('./routes/sign_up') 10 +var signupRouter = require('./routes/signup')
11 var lpgRouter = require('./routes/lpg') 11 var lpgRouter = require('./routes/lpg')
12 var weatherRouter = require('./routes/weather') 12 var weatherRouter = require('./routes/weather')
13 var menuRouter = require('./routes/menu') 13 var menuRouter = require('./routes/menu')
14 var app = express(); 14 var app = express();
15 var router = express.Router(); 15 var router = express.Router();
16 16
17 +var cookieParser = require('cookie-parser')
18 +var ExpressSession = require('express-session')
17 19
18 // get port 20 // get port
19 var port = process.env.PORT || 3000; 21 var port = process.env.PORT || 3000;
...@@ -40,10 +42,17 @@ app.use('/menu',menuRouter) ...@@ -40,10 +42,17 @@ app.use('/menu',menuRouter)
40 app.use('/login',loginRouter); // login page route 42 app.use('/login',loginRouter); // login page route
41 app.use('/weather',weatherRouter) 43 app.use('/weather',weatherRouter)
42 app.use('/lpg',lpgRouter) 44 app.use('/lpg',lpgRouter)
43 -app.use('/signup',sign_upRouter); // sign up page route 45 +app.use('/signup',signupRouter); // sign up page route
44 app.use('/', indexRouter); // main page route 46 app.use('/', indexRouter); // main page route
45 47
46 48
49 +//Session 처리
50 +app.use(cookieParser());
51 +app.use(ExpressSession({
52 + secret:'key',
53 + resave: true,
54 + saveUninitialized:true
55 +}));
47 56
48 //모든 router 처리가 끝난 후 404 오류 페이지 처리 57 //모든 router 처리가 끝난 후 404 오류 페이지 처리
49 var errorHandler = expressErrorHandler({ 58 var errorHandler = expressErrorHandler({
......
...@@ -40,7 +40,39 @@ var adduser = function(name, id, password, callback) { ...@@ -40,7 +40,39 @@ var adduser = function(name, id, password, callback) {
40 }) 40 })
41 } 41 }
42 42
43 +var authUser = function(id, password, callback) {
44 + console.log('authUser 호출');
45 +
46 + pool.getConnection(function(err, conn) {
47 + if(err){
48 + if(conn){
49 + conn.release();
50 + }
51 +
52 + callback(err, null);
53 + return;
54 + }
55 +
56 + var colums = ['name', 'id'];
57 + var tablename = 'users';
58 +
59 + var exec = conn.query("select ?? from ?? where id = ? and password = ?",
60 + [colums, tablename, id, password], function(err, rows) {
61 + conn.release();
62 +
63 + if(rows.length >0){
64 + console.log('Id [%s], password [$s] 일치하는 사용자 찾음', id, password);
65 + callback(null, rows);
66 + } else {
67 + console.log('일치하는 사용자 없음');
68 + callback(null, null);
69 + }
70 + }
71 + );
72 + })
73 +}
74 +
43 module.exports.pool = pool; 75 module.exports.pool = pool;
44 -//module.exports.login = login; 76 +module.exports.authUser = authUser;
45 module.exports.adduser = adduser; 77 module.exports.adduser = adduser;
46 //module.exports.listuser = listuser; 78 //module.exports.listuser = listuser;
......
1 var express = require('express') 1 var express = require('express')
2 -var User = require('../database/User') 2 +var Conn = require('../database/Connection')
3 var router = express.Router() 3 var router = express.Router()
4 4
5 //라우팅 함수 등록 5 //라우팅 함수 등록
...@@ -8,30 +8,52 @@ router.get('/',function(req,res){ ...@@ -8,30 +8,52 @@ router.get('/',function(req,res){
8 res.render('login.html') 8 res.render('login.html')
9 }); 9 });
10 10
11 -router.post('/process', async (req, res) => { 11 +router.post('/process', function(req, res) {
12 - console.log('/process/login 처리함'); 12 + console.log('/login/process 처리함');
13 13
14 var paramId = req.body.id || req.query.id; 14 var paramId = req.body.id || req.query.id;
15 var paramPassword = req.body.password || req.query.password; 15 var paramPassword = req.body.password || req.query.password;
16 //GET, POST 모두 고려해서 둘 다 검사 16 //GET, POST 모두 고려해서 둘 다 검사
17 17
18 - const results = await User.login(paramId, paramPassword); 18 + if(Conn.pool){
19 + Conn.authUser(paramId, paramPassword, function(err, rows) {
20 + if(err){
21 + console.error(err.stack);
22 + res.writeHead('200', { 'Content-Type': 'text/html;charset=utf8' });
23 + res.write('<h1>로그인 중 오류</h1>');
24 + res.write('<div><p>Param id : ' + paramId + '</p></div>');
25 + res.write('<div><p>Param password : ' + paramPassword + '</p></div>');
26 + res.write("<br><br><a href ='/login'>로그인 페이지로 돌아가기</a>");
27 + res.end();
28 +
29 + return;
30 + }
31 + if (rows){
32 + console.dir(rows);
19 33
20 - if (results){ 34 + res.writeHead('200', { 'Content-Type': 'text/html;charset=utf8' });
35 + res.write('<h1>로그인 성공</h1>');
36 + res.write('<div><p>Param name : ' + rows[0].name + '</p></div>');
37 + res.write('<div><p>Param id : ' + paramId + '</p></div>');
38 + res.write("<br><br><a href ='/login'>로그인 페이지로 돌아가기</a>");
39 + res.end();
40 + } else {
41 + res.writeHead('200', { 'Content-Type': 'text/html;charset=utf8' });
42 + res.write('<h1>로그인 실패.</h1>');
43 + res.write('<div><p>Param id : ' + paramId + '</p></div>');
44 + res.write("<br><br><a href ='/login'>로그인 페이지로 돌아가기</a>");
45 + res.end();
46 + }
47 +
48 + })
49 + }else{
21 res.writeHead('200', { 'Content-Type': 'text/html;charset=utf8' }); 50 res.writeHead('200', { 'Content-Type': 'text/html;charset=utf8' });
22 - res.write('<h1>로그인 성공</h1>'); 51 + res.write('<h1>데이터베이스 연결 실패</h1>');
23 - res.write('<div><p>Param id : ' + paramId + '</p></div>');
24 - res.write('<div><p>Param password : ' + paramPassword + '</p></div>');
25 - res.write("<br><br><a href ='/login.html'>로그인 페이지로 돌아가기</a>");
26 - res.end();
27 - } else {
28 - res.writeHead('200', { 'Content-Type': 'text/html;charset=utf8' });
29 - res.write('<h1>정보가 잘못되었습니다.</h1>');
30 - res.write('<div><p>Param id : ' + paramId + '</p></div>');
31 - res.write('<div><p>Param password : ' + paramPassword + '</p></div>');
32 - res.write("<br><br><a href ='/login.html'>로그인 페이지로 돌아가기</a>");
33 res.end(); 52 res.end();
34 } 53 }
54 +
55 +
35 }); 56 });
36 57
58 +
37 module.exports = router 59 module.exports = router
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -3,7 +3,7 @@ var Conn = require('../database/Connection') ...@@ -3,7 +3,7 @@ var Conn = require('../database/Connection')
3 var router = express.Router() 3 var router = express.Router()
4 4
5 router.get('/',function(req,res){ 5 router.get('/',function(req,res){
6 - res.render('views/signup.html') 6 + res.render('signup.html')
7 }); 7 });
8 8
9 9
...@@ -20,11 +20,11 @@ router.post('/process', function(req, res) { ...@@ -20,11 +20,11 @@ router.post('/process', function(req, res) {
20 if(err){ 20 if(err){
21 console.error(err.stack); 21 console.error(err.stack);
22 res.writeHead('200', { 'Content-Type': 'text/html;charset=utf8' }); 22 res.writeHead('200', { 'Content-Type': 'text/html;charset=utf8' });
23 - res.write('<h1>추가 중 오류</h1>'); 23 + res.write('<h1>ID가 중복되었습니다. 다른 ID를 사용해주세요.</h1>');
24 res.write('<div><p>Param name : ' + paramName + '</p></div>'); 24 res.write('<div><p>Param name : ' + paramName + '</p></div>');
25 res.write('<div><p>Param id : ' + paramId + '</p></div>'); 25 res.write('<div><p>Param id : ' + paramId + '</p></div>');
26 res.write('<div><p>Param password : ' + paramPassword + '</p></div>'); 26 res.write('<div><p>Param password : ' + paramPassword + '</p></div>');
27 - res.write("<br><br><a href ='/login.html'>로그인 페이지로 돌아가기</a>"); 27 + res.write("<br><br><a href ='/login'>로그인 페이지로 돌아가기</a>");
28 res.end(); 28 res.end();
29 29
30 return; 30 return;
...@@ -37,14 +37,14 @@ router.post('/process', function(req, res) { ...@@ -37,14 +37,14 @@ router.post('/process', function(req, res) {
37 res.write('<div><p>Param name : ' + paramName + '</p></div>'); 37 res.write('<div><p>Param name : ' + paramName + '</p></div>');
38 res.write('<div><p>Param id : ' + paramId + '</p></div>'); 38 res.write('<div><p>Param id : ' + paramId + '</p></div>');
39 res.write('<div><p>Param password : ' + paramPassword + '</p></div>'); 39 res.write('<div><p>Param password : ' + paramPassword + '</p></div>');
40 - res.write("<br><br><a href ='/login.html'>로그인 페이지로 돌아가기</a>"); 40 + res.write("<br><br><a href ='/login'>로그인 페이지로 돌아가기</a>");
41 res.end(); 41 res.end();
42 } else { 42 } else {
43 res.writeHead('200', { 'Content-Type': 'text/html;charset=utf8' }); 43 res.writeHead('200', { 'Content-Type': 'text/html;charset=utf8' });
44 res.write('<h1>회원가입 실패.</h1>'); 44 res.write('<h1>회원가입 실패.</h1>');
45 res.write('<div><p>Param id : ' + paramId + '</p></div>'); 45 res.write('<div><p>Param id : ' + paramId + '</p></div>');
46 res.write('<div><p>Param password : ' + paramPassword + '</p></div>'); 46 res.write('<div><p>Param password : ' + paramPassword + '</p></div>');
47 - res.write("<br><br><a href ='/login.html'>로그인 페이지로 돌아가기</a>"); 47 + res.write("<br><br><a href ='/login'>로그인 페이지로 돌아가기</a>");
48 res.end(); 48 res.end();
49 } 49 }
50 50
......
...@@ -37,8 +37,8 @@ ...@@ -37,8 +37,8 @@
37 <li class="nav-item dropdown"> 37 <li class="nav-item dropdown">
38 <a class="nav-link dropdown-toggle" id="navbarDropdownLogin" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">Login</a> 38 <a class="nav-link dropdown-toggle" id="navbarDropdownLogin" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">Login</a>
39 <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownLogin"> 39 <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownLogin">
40 - <li><a class="dropdown-item" href="login.html">Login</a></li> 40 + <li><a class="dropdown-item" href="/login">Login</a></li>
41 - <li><a class="dropdown-item" href="signup.html">Sign-up</a></li> 41 + <li><a class="dropdown-item" href="/signup">Sign-up</a></li>
42 </ul> 42 </ul>
43 </li> 43 </li>
44 </ul> 44 </ul>
......
...@@ -37,8 +37,8 @@ ...@@ -37,8 +37,8 @@
37 <li class="nav-item dropdown"> 37 <li class="nav-item dropdown">
38 <a class="nav-link dropdown-toggle" id="navbarDropdownLogin" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">Login</a> 38 <a class="nav-link dropdown-toggle" id="navbarDropdownLogin" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">Login</a>
39 <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownLogin"> 39 <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownLogin">
40 - <li><a class="dropdown-item" href="login.html">Login</a></li> 40 + <li><a class="dropdown-item" href="/login">Login</a></li>
41 - <li><a class="dropdown-item" href="signup.html">Sign-up</a></li> 41 + <li><a class="dropdown-item" href="/signup">Sign-up</a></li>
42 </ul> 42 </ul>
43 </li> 43 </li>
44 </ul> 44 </ul>
......
...@@ -37,8 +37,8 @@ ...@@ -37,8 +37,8 @@
37 <li class="nav-item dropdown"> 37 <li class="nav-item dropdown">
38 <a class="nav-link dropdown-toggle" id="navbarDropdownLogin" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">Login</a> 38 <a class="nav-link dropdown-toggle" id="navbarDropdownLogin" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">Login</a>
39 <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownLogin"> 39 <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownLogin">
40 - <li><a class="dropdown-item" href="login.html">Login</a></li> 40 + <li><a class="dropdown-item" href="/login">Login</a></li>
41 - <li><a class="dropdown-item" href="signup.html">Sign-up</a></li> 41 + <li><a class="dropdown-item" href="/signup">Sign-up</a></li>
42 </ul> 42 </ul>
43 </li> 43 </li>
44 </ul> 44 </ul>
......
...@@ -44,8 +44,8 @@ ...@@ -44,8 +44,8 @@
44 <a class="nav-link dropdown-toggle" id="navbarDropdownLogin" href="#" role="button" 44 <a class="nav-link dropdown-toggle" id="navbarDropdownLogin" href="#" role="button"
45 data-bs-toggle="dropdown" aria-expanded="false">Login</a> 45 data-bs-toggle="dropdown" aria-expanded="false">Login</a>
46 <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownLogin"> 46 <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownLogin">
47 - <li><a class="dropdown-item" href="login.html">Login</a></li> 47 + <li><a class="dropdown-item" href="/login">Login</a></li>
48 - <li><a class="dropdown-item" href="signup.html">Sign-up</a></li> 48 + <li><a class="dropdown-item" href="/signup">Sign-up</a></li>
49 </ul> 49 </ul>
50 </li> 50 </li>
51 </ul> 51 </ul>
......
...@@ -37,8 +37,8 @@ ...@@ -37,8 +37,8 @@
37 <li class="nav-item dropdown"> 37 <li class="nav-item dropdown">
38 <a class="nav-link dropdown-toggle" id="navbarDropdownLogin" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">Login</a> 38 <a class="nav-link dropdown-toggle" id="navbarDropdownLogin" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">Login</a>
39 <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownLogin"> 39 <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownLogin">
40 - <li><a class="dropdown-item" href="login.html">Login</a></li> 40 + <li><a class="dropdown-item" href="/login">Login</a></li>
41 - <li><a class="dropdown-item" href="signup.html">Sign-up</a></li> 41 + <li><a class="dropdown-item" href="/signup">Sign-up</a></li>
42 </ul> 42 </ul>
43 </li> 43 </li>
44 </ul> 44 </ul>
......
...@@ -37,8 +37,8 @@ ...@@ -37,8 +37,8 @@
37 <li class="nav-item dropdown"> 37 <li class="nav-item dropdown">
38 <a class="nav-link dropdown-toggle" id="navbarDropdownLogin" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">Login</a> 38 <a class="nav-link dropdown-toggle" id="navbarDropdownLogin" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">Login</a>
39 <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownLogin"> 39 <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownLogin">
40 - <li><a class="dropdown-item" href="login.html">Login</a></li> 40 + <li><a class="dropdown-item" href="/login">Login</a></li>
41 - <li><a class="dropdown-item" href="signup.html">Sign-up</a></li> 41 + <li><a class="dropdown-item" href="/signup">Sign-up</a></li>
42 </ul> 42 </ul>
43 </li> 43 </li>
44 </ul> 44 </ul>
......
...@@ -44,8 +44,8 @@ ...@@ -44,8 +44,8 @@
44 <a class="nav-link dropdown-toggle" id="navbarDropdownLogin" href="#" role="button" 44 <a class="nav-link dropdown-toggle" id="navbarDropdownLogin" href="#" role="button"
45 data-bs-toggle="dropdown" aria-expanded="false">Login</a> 45 data-bs-toggle="dropdown" aria-expanded="false">Login</a>
46 <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownLogin"> 46 <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownLogin">
47 - <li><a class="dropdown-item" href="login.html">Login</a></li> 47 + <li><a class="dropdown-item" href="/login">Login</a></li>
48 - <li><a class="dropdown-item" href="signup.html">Sign-up</a></li> 48 + <li><a class="dropdown-item" href="/signup">Sign-up</a></li>
49 </ul> 49 </ul>
50 </li> 50 </li>
51 </ul> 51 </ul>
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
58 <div class="row justify-content-center"> 58 <div class="row justify-content-center">
59 <div class="col-lg-8 col-xxl-6"> 59 <div class="col-lg-8 col-xxl-6">
60 <div class="text-center my-5"> 60 <div class="text-center my-5">
61 - <h1>로그인</h1> 61 + <h1>회원가입</h1>
62 <br> 62 <br>
63 <form method="post" action="/signup/process"> 63 <form method="post" action="/signup/process">
64 <table> 64 <table>
......
...@@ -37,8 +37,8 @@ ...@@ -37,8 +37,8 @@
37 <li class="nav-item dropdown"> 37 <li class="nav-item dropdown">
38 <a class="nav-link dropdown-toggle" id="navbarDropdownLogin" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">Login</a> 38 <a class="nav-link dropdown-toggle" id="navbarDropdownLogin" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">Login</a>
39 <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownLogin"> 39 <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownLogin">
40 - <li><a class="dropdown-item" href="login.html">Login</a></li> 40 + <li><a class="dropdown-item" href="/login">Login</a></li>
41 - <li><a class="dropdown-item" href="signup.html">Sign-up</a></li> 41 + <li><a class="dropdown-item" href="/signup">Sign-up</a></li>
42 </ul> 42 </ul>
43 </li> 43 </li>
44 </ul> 44 </ul>
......
...@@ -190,6 +190,26 @@ ...@@ -190,6 +190,26 @@
190 "node": ">= 0.6" 190 "node": ">= 0.6"
191 } 191 }
192 }, 192 },
193 + "node_modules/cookie-parser": {
194 + "version": "1.4.6",
195 + "resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.6.tgz",
196 + "integrity": "sha512-z3IzaNjdwUC2olLIB5/ITd0/setiaFMLYiZJle7xg5Fe9KWAceil7xszYfHHBtDFYLSgJduS2Ty0P1uJdPDJeA==",
197 + "dependencies": {
198 + "cookie": "0.4.1",
199 + "cookie-signature": "1.0.6"
200 + },
201 + "engines": {
202 + "node": ">= 0.8.0"
203 + }
204 + },
205 + "node_modules/cookie-parser/node_modules/cookie": {
206 + "version": "0.4.1",
207 + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.1.tgz",
208 + "integrity": "sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA==",
209 + "engines": {
210 + "node": ">= 0.6"
211 + }
212 + },
193 "node_modules/cookie-signature": { 213 "node_modules/cookie-signature": {
194 "version": "1.0.6", 214 "version": "1.0.6",
195 "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", 215 "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
...@@ -314,6 +334,32 @@ ...@@ -314,6 +334,32 @@
314 "mout": "0.12.0" 334 "mout": "0.12.0"
315 } 335 }
316 }, 336 },
337 + "node_modules/express-session": {
338 + "version": "1.17.3",
339 + "resolved": "https://registry.npmjs.org/express-session/-/express-session-1.17.3.tgz",
340 + "integrity": "sha512-4+otWXlShYlG1Ma+2Jnn+xgKUZTMJ5QD3YvfilX3AcocOAbIkVylSWEklzALe/+Pu4qV6TYBj5GwOBFfdKqLBw==",
341 + "dependencies": {
342 + "cookie": "0.4.2",
343 + "cookie-signature": "1.0.6",
344 + "debug": "2.6.9",
345 + "depd": "~2.0.0",
346 + "on-headers": "~1.0.2",
347 + "parseurl": "~1.3.3",
348 + "safe-buffer": "5.2.1",
349 + "uid-safe": "~2.1.5"
350 + },
351 + "engines": {
352 + "node": ">= 0.8.0"
353 + }
354 + },
355 + "node_modules/express-session/node_modules/cookie": {
356 + "version": "0.4.2",
357 + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz",
358 + "integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==",
359 + "engines": {
360 + "node": ">= 0.6"
361 + }
362 + },
317 "node_modules/filelist": { 363 "node_modules/filelist": {
318 "version": "1.0.3", 364 "version": "1.0.3",
319 "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.3.tgz", 365 "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.3.tgz",
...@@ -606,6 +652,14 @@ ...@@ -606,6 +652,14 @@
606 "node": ">= 0.8" 652 "node": ">= 0.8"
607 } 653 }
608 }, 654 },
655 + "node_modules/on-headers": {
656 + "version": "1.0.2",
657 + "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz",
658 + "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==",
659 + "engines": {
660 + "node": ">= 0.8"
661 + }
662 + },
609 "node_modules/parseurl": { 663 "node_modules/parseurl": {
610 "version": "1.3.3", 664 "version": "1.3.3",
611 "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", 665 "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
...@@ -667,6 +721,14 @@ ...@@ -667,6 +721,14 @@
667 "url": "https://github.com/sponsors/ljharb" 721 "url": "https://github.com/sponsors/ljharb"
668 } 722 }
669 }, 723 },
724 + "node_modules/random-bytes": {
725 + "version": "1.0.0",
726 + "resolved": "https://registry.npmjs.org/random-bytes/-/random-bytes-1.0.0.tgz",
727 + "integrity": "sha1-T2ih3Arli9P7lYSMMDJNt11kNgs=",
728 + "engines": {
729 + "node": ">= 0.8"
730 + }
731 + },
670 "node_modules/range-parser": { 732 "node_modules/range-parser": {
671 "version": "1.2.1", 733 "version": "1.2.1",
672 "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", 734 "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
...@@ -852,6 +914,17 @@ ...@@ -852,6 +914,17 @@
852 "node": ">= 0.6" 914 "node": ">= 0.6"
853 } 915 }
854 }, 916 },
917 + "node_modules/uid-safe": {
918 + "version": "2.1.5",
919 + "resolved": "https://registry.npmjs.org/uid-safe/-/uid-safe-2.1.5.tgz",
920 + "integrity": "sha512-KPHm4VL5dDXKz01UuEd88Df+KzynaohSL9fBh096KWAxSKZQDI2uBrVqtvRM4rwrIrRRKsdLNML/lnaaVSRioA==",
921 + "dependencies": {
922 + "random-bytes": "~1.0.0"
923 + },
924 + "engines": {
925 + "node": ">= 0.8"
926 + }
927 + },
855 "node_modules/unpipe": { 928 "node_modules/unpipe": {
856 "version": "1.0.0", 929 "version": "1.0.0",
857 "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", 930 "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
......
...@@ -11,9 +11,11 @@ ...@@ -11,9 +11,11 @@
11 "dependencies": { 11 "dependencies": {
12 "body-parser": "^1.20.0", 12 "body-parser": "^1.20.0",
13 "bootstrap": "^5.1.3", 13 "bootstrap": "^5.1.3",
14 + "cookie-parser": "^1.4.6",
14 "ejs": "^3.1.7", 15 "ejs": "^3.1.7",
15 "express": "^4.18.1", 16 "express": "^4.18.1",
16 "express-error-handler": "^1.1.0", 17 "express-error-handler": "^1.1.0",
18 + "express-session": "^1.17.3",
17 "http": "^0.0.1-security", 19 "http": "^0.0.1-security",
18 "mysql": "^2.18.1", 20 "mysql": "^2.18.1",
19 "path": "^0.12.7", 21 "path": "^0.12.7",
...@@ -206,6 +208,26 @@ ...@@ -206,6 +208,26 @@
206 "node": ">= 0.6" 208 "node": ">= 0.6"
207 } 209 }
208 }, 210 },
211 + "node_modules/cookie-parser": {
212 + "version": "1.4.6",
213 + "resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.6.tgz",
214 + "integrity": "sha512-z3IzaNjdwUC2olLIB5/ITd0/setiaFMLYiZJle7xg5Fe9KWAceil7xszYfHHBtDFYLSgJduS2Ty0P1uJdPDJeA==",
215 + "dependencies": {
216 + "cookie": "0.4.1",
217 + "cookie-signature": "1.0.6"
218 + },
219 + "engines": {
220 + "node": ">= 0.8.0"
221 + }
222 + },
223 + "node_modules/cookie-parser/node_modules/cookie": {
224 + "version": "0.4.1",
225 + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.1.tgz",
226 + "integrity": "sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA==",
227 + "engines": {
228 + "node": ">= 0.6"
229 + }
230 + },
209 "node_modules/cookie-signature": { 231 "node_modules/cookie-signature": {
210 "version": "1.0.6", 232 "version": "1.0.6",
211 "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", 233 "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
...@@ -330,6 +352,32 @@ ...@@ -330,6 +352,32 @@
330 "mout": "0.12.0" 352 "mout": "0.12.0"
331 } 353 }
332 }, 354 },
355 + "node_modules/express-session": {
356 + "version": "1.17.3",
357 + "resolved": "https://registry.npmjs.org/express-session/-/express-session-1.17.3.tgz",
358 + "integrity": "sha512-4+otWXlShYlG1Ma+2Jnn+xgKUZTMJ5QD3YvfilX3AcocOAbIkVylSWEklzALe/+Pu4qV6TYBj5GwOBFfdKqLBw==",
359 + "dependencies": {
360 + "cookie": "0.4.2",
361 + "cookie-signature": "1.0.6",
362 + "debug": "2.6.9",
363 + "depd": "~2.0.0",
364 + "on-headers": "~1.0.2",
365 + "parseurl": "~1.3.3",
366 + "safe-buffer": "5.2.1",
367 + "uid-safe": "~2.1.5"
368 + },
369 + "engines": {
370 + "node": ">= 0.8.0"
371 + }
372 + },
373 + "node_modules/express-session/node_modules/cookie": {
374 + "version": "0.4.2",
375 + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz",
376 + "integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==",
377 + "engines": {
378 + "node": ">= 0.6"
379 + }
380 + },
333 "node_modules/filelist": { 381 "node_modules/filelist": {
334 "version": "1.0.3", 382 "version": "1.0.3",
335 "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.3.tgz", 383 "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.3.tgz",
...@@ -622,6 +670,14 @@ ...@@ -622,6 +670,14 @@
622 "node": ">= 0.8" 670 "node": ">= 0.8"
623 } 671 }
624 }, 672 },
673 + "node_modules/on-headers": {
674 + "version": "1.0.2",
675 + "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz",
676 + "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==",
677 + "engines": {
678 + "node": ">= 0.8"
679 + }
680 + },
625 "node_modules/parseurl": { 681 "node_modules/parseurl": {
626 "version": "1.3.3", 682 "version": "1.3.3",
627 "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", 683 "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
...@@ -683,6 +739,14 @@ ...@@ -683,6 +739,14 @@
683 "url": "https://github.com/sponsors/ljharb" 739 "url": "https://github.com/sponsors/ljharb"
684 } 740 }
685 }, 741 },
742 + "node_modules/random-bytes": {
743 + "version": "1.0.0",
744 + "resolved": "https://registry.npmjs.org/random-bytes/-/random-bytes-1.0.0.tgz",
745 + "integrity": "sha1-T2ih3Arli9P7lYSMMDJNt11kNgs=",
746 + "engines": {
747 + "node": ">= 0.8"
748 + }
749 + },
686 "node_modules/range-parser": { 750 "node_modules/range-parser": {
687 "version": "1.2.1", 751 "version": "1.2.1",
688 "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", 752 "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
...@@ -868,6 +932,17 @@ ...@@ -868,6 +932,17 @@
868 "node": ">= 0.6" 932 "node": ">= 0.6"
869 } 933 }
870 }, 934 },
935 + "node_modules/uid-safe": {
936 + "version": "2.1.5",
937 + "resolved": "https://registry.npmjs.org/uid-safe/-/uid-safe-2.1.5.tgz",
938 + "integrity": "sha512-KPHm4VL5dDXKz01UuEd88Df+KzynaohSL9fBh096KWAxSKZQDI2uBrVqtvRM4rwrIrRRKsdLNML/lnaaVSRioA==",
939 + "dependencies": {
940 + "random-bytes": "~1.0.0"
941 + },
942 + "engines": {
943 + "node": ">= 0.8"
944 + }
945 + },
871 "node_modules/unpipe": { 946 "node_modules/unpipe": {
872 "version": "1.0.0", 947 "version": "1.0.0",
873 "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", 948 "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
...@@ -1048,6 +1123,22 @@ ...@@ -1048,6 +1123,22 @@
1048 "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", 1123 "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz",
1049 "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==" 1124 "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw=="
1050 }, 1125 },
1126 + "cookie-parser": {
1127 + "version": "1.4.6",
1128 + "resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.6.tgz",
1129 + "integrity": "sha512-z3IzaNjdwUC2olLIB5/ITd0/setiaFMLYiZJle7xg5Fe9KWAceil7xszYfHHBtDFYLSgJduS2Ty0P1uJdPDJeA==",
1130 + "requires": {
1131 + "cookie": "0.4.1",
1132 + "cookie-signature": "1.0.6"
1133 + },
1134 + "dependencies": {
1135 + "cookie": {
1136 + "version": "0.4.1",
1137 + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.1.tgz",
1138 + "integrity": "sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA=="
1139 + }
1140 + }
1141 + },
1051 "cookie-signature": { 1142 "cookie-signature": {
1052 "version": "1.0.6", 1143 "version": "1.0.6",
1053 "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", 1144 "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
...@@ -1150,6 +1241,28 @@ ...@@ -1150,6 +1241,28 @@
1150 "mout": "0.12.0" 1241 "mout": "0.12.0"
1151 } 1242 }
1152 }, 1243 },
1244 + "express-session": {
1245 + "version": "1.17.3",
1246 + "resolved": "https://registry.npmjs.org/express-session/-/express-session-1.17.3.tgz",
1247 + "integrity": "sha512-4+otWXlShYlG1Ma+2Jnn+xgKUZTMJ5QD3YvfilX3AcocOAbIkVylSWEklzALe/+Pu4qV6TYBj5GwOBFfdKqLBw==",
1248 + "requires": {
1249 + "cookie": "0.4.2",
1250 + "cookie-signature": "1.0.6",
1251 + "debug": "2.6.9",
1252 + "depd": "~2.0.0",
1253 + "on-headers": "~1.0.2",
1254 + "parseurl": "~1.3.3",
1255 + "safe-buffer": "5.2.1",
1256 + "uid-safe": "~2.1.5"
1257 + },
1258 + "dependencies": {
1259 + "cookie": {
1260 + "version": "0.4.2",
1261 + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz",
1262 + "integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA=="
1263 + }
1264 + }
1265 + },
1153 "filelist": { 1266 "filelist": {
1154 "version": "1.0.3", 1267 "version": "1.0.3",
1155 "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.3.tgz", 1268 "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.3.tgz",
...@@ -1371,6 +1484,11 @@ ...@@ -1371,6 +1484,11 @@
1371 "ee-first": "1.1.1" 1484 "ee-first": "1.1.1"
1372 } 1485 }
1373 }, 1486 },
1487 + "on-headers": {
1488 + "version": "1.0.2",
1489 + "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz",
1490 + "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA=="
1491 + },
1374 "parseurl": { 1492 "parseurl": {
1375 "version": "1.3.3", 1493 "version": "1.3.3",
1376 "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", 1494 "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
...@@ -1417,6 +1535,11 @@ ...@@ -1417,6 +1535,11 @@
1417 "side-channel": "^1.0.4" 1535 "side-channel": "^1.0.4"
1418 } 1536 }
1419 }, 1537 },
1538 + "random-bytes": {
1539 + "version": "1.0.0",
1540 + "resolved": "https://registry.npmjs.org/random-bytes/-/random-bytes-1.0.0.tgz",
1541 + "integrity": "sha1-T2ih3Arli9P7lYSMMDJNt11kNgs="
1542 + },
1420 "range-parser": { 1543 "range-parser": {
1421 "version": "1.2.1", 1544 "version": "1.2.1",
1422 "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", 1545 "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
...@@ -1564,6 +1687,14 @@ ...@@ -1564,6 +1687,14 @@
1564 "mime-types": "~2.1.24" 1687 "mime-types": "~2.1.24"
1565 } 1688 }
1566 }, 1689 },
1690 + "uid-safe": {
1691 + "version": "2.1.5",
1692 + "resolved": "https://registry.npmjs.org/uid-safe/-/uid-safe-2.1.5.tgz",
1693 + "integrity": "sha512-KPHm4VL5dDXKz01UuEd88Df+KzynaohSL9fBh096KWAxSKZQDI2uBrVqtvRM4rwrIrRRKsdLNML/lnaaVSRioA==",
1694 + "requires": {
1695 + "random-bytes": "~1.0.0"
1696 + }
1697 + },
1567 "unpipe": { 1698 "unpipe": {
1568 "version": "1.0.0", 1699 "version": "1.0.0",
1569 "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", 1700 "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
......
...@@ -11,9 +11,11 @@ ...@@ -11,9 +11,11 @@
11 "dependencies": { 11 "dependencies": {
12 "body-parser": "^1.20.0", 12 "body-parser": "^1.20.0",
13 "bootstrap": "^5.1.3", 13 "bootstrap": "^5.1.3",
14 + "cookie-parser": "^1.4.6",
14 "ejs": "^3.1.7", 15 "ejs": "^3.1.7",
15 "express": "^4.18.1", 16 "express": "^4.18.1",
16 "express-error-handler": "^1.1.0", 17 "express-error-handler": "^1.1.0",
18 + "express-session": "^1.17.3",
17 "http": "^0.0.1-security", 19 "http": "^0.0.1-security",
18 "mysql": "^2.18.1", 20 "mysql": "^2.18.1",
19 "path": "^0.12.7", 21 "path": "^0.12.7",
......