최정민

FEAT : 2차로그인 기능추가

session-file-store를 이용하여 회원가입 진행

-
...@@ -62,11 +62,27 @@ ...@@ -62,11 +62,27 @@
62 "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz", 62 "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz",
63 "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==" 63 "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug=="
64 }, 64 },
65 + "asn1.js": {
66 + "version": "5.4.1",
67 + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz",
68 + "integrity": "sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==",
69 + "requires": {
70 + "bn.js": "^4.0.0",
71 + "inherits": "^2.0.1",
72 + "minimalistic-assert": "^1.0.0",
73 + "safer-buffer": "^2.1.0"
74 + }
75 + },
65 "async": { 76 "async": {
66 "version": "0.9.2", 77 "version": "0.9.2",
67 "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", 78 "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz",
68 "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=" 79 "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0="
69 }, 80 },
81 + "bagpipe": {
82 + "version": "0.3.5",
83 + "resolved": "https://registry.npmjs.org/bagpipe/-/bagpipe-0.3.5.tgz",
84 + "integrity": "sha1-40HRZPyyTN8E6n4Ft2XsEMiupqE="
85 + },
70 "balanced-match": { 86 "balanced-match": {
71 "version": "1.0.2", 87 "version": "1.0.2",
72 "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", 88 "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
...@@ -90,6 +106,11 @@ ...@@ -90,6 +106,11 @@
90 "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.1.tgz", 106 "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.1.tgz",
91 "integrity": "sha512-IdZR9mh6ahOBv/hYGiXyVuyCetmGJhtYkqLBpTStdhEGjegpPlUawydyaF3pbIOFynJTpllEs+NP+CS9jKFLjA==" 107 "integrity": "sha512-IdZR9mh6ahOBv/hYGiXyVuyCetmGJhtYkqLBpTStdhEGjegpPlUawydyaF3pbIOFynJTpllEs+NP+CS9jKFLjA=="
92 }, 108 },
109 + "bn.js": {
110 + "version": "4.12.0",
111 + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz",
112 + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA=="
113 + },
93 "body-parser": { 114 "body-parser": {
94 "version": "1.18.3", 115 "version": "1.18.3",
95 "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz", 116 "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz",
...@@ -291,6 +312,33 @@ ...@@ -291,6 +312,33 @@
291 } 312 }
292 } 313 }
293 }, 314 },
315 + "express-session": {
316 + "version": "1.17.1",
317 + "resolved": "https://registry.npmjs.org/express-session/-/express-session-1.17.1.tgz",
318 + "integrity": "sha512-UbHwgqjxQZJiWRTMyhvWGvjBQduGCSBDhhZXYenziMFjxst5rMV+aJZ6hKPHZnPyHGsrqRICxtX8jtEbm/z36Q==",
319 + "requires": {
320 + "cookie": "0.4.0",
321 + "cookie-signature": "1.0.6",
322 + "debug": "2.6.9",
323 + "depd": "~2.0.0",
324 + "on-headers": "~1.0.2",
325 + "parseurl": "~1.3.3",
326 + "safe-buffer": "5.2.0",
327 + "uid-safe": "~2.1.5"
328 + },
329 + "dependencies": {
330 + "depd": {
331 + "version": "2.0.0",
332 + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
333 + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw=="
334 + },
335 + "safe-buffer": {
336 + "version": "5.2.0",
337 + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz",
338 + "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg=="
339 + }
340 + }
341 + },
294 "extend": { 342 "extend": {
295 "version": "3.0.2", 343 "version": "3.0.2",
296 "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", 344 "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
...@@ -333,6 +381,16 @@ ...@@ -333,6 +381,16 @@
333 "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", 381 "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
334 "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" 382 "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
335 }, 383 },
384 + "fs-extra": {
385 + "version": "8.1.0",
386 + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz",
387 + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==",
388 + "requires": {
389 + "graceful-fs": "^4.2.0",
390 + "jsonfile": "^4.0.0",
391 + "universalify": "^0.1.0"
392 + }
393 + },
336 "gaxios": { 394 "gaxios": {
337 "version": "4.2.1", 395 "version": "4.2.1",
338 "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-4.2.1.tgz", 396 "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-4.2.1.tgz",
...@@ -378,6 +436,11 @@ ...@@ -378,6 +436,11 @@
378 "node-forge": "^0.10.0" 436 "node-forge": "^0.10.0"
379 } 437 }
380 }, 438 },
439 + "graceful-fs": {
440 + "version": "4.2.6",
441 + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz",
442 + "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ=="
443 + },
381 "gtoken": { 444 "gtoken": {
382 "version": "5.2.1", 445 "version": "5.2.1",
383 "resolved": "https://registry.npmjs.org/gtoken/-/gtoken-5.2.1.tgz", 446 "resolved": "https://registry.npmjs.org/gtoken/-/gtoken-5.2.1.tgz",
...@@ -436,6 +499,11 @@ ...@@ -436,6 +499,11 @@
436 "safer-buffer": ">= 2.1.2 < 3" 499 "safer-buffer": ">= 2.1.2 < 3"
437 } 500 }
438 }, 501 },
502 + "imurmurhash": {
503 + "version": "0.1.4",
504 + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
505 + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o="
506 + },
439 "inherits": { 507 "inherits": {
440 "version": "2.0.3", 508 "version": "2.0.3",
441 "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", 509 "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
...@@ -451,6 +519,11 @@ ...@@ -451,6 +519,11 @@
451 "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", 519 "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz",
452 "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==" 520 "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw=="
453 }, 521 },
522 + "is-typedarray": {
523 + "version": "1.0.0",
524 + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
525 + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo="
526 + },
454 "jake": { 527 "jake": {
455 "version": "10.8.2", 528 "version": "10.8.2",
456 "resolved": "https://registry.npmjs.org/jake/-/jake-10.8.2.tgz", 529 "resolved": "https://registry.npmjs.org/jake/-/jake-10.8.2.tgz",
...@@ -470,6 +543,14 @@ ...@@ -470,6 +543,14 @@
470 "bignumber.js": "^9.0.0" 543 "bignumber.js": "^9.0.0"
471 } 544 }
472 }, 545 },
546 + "jsonfile": {
547 + "version": "4.0.0",
548 + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
549 + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=",
550 + "requires": {
551 + "graceful-fs": "^4.1.6"
552 + }
553 + },
473 "jwa": { 554 "jwa": {
474 "version": "2.0.0", 555 "version": "2.0.0",
475 "resolved": "https://registry.npmjs.org/jwa/-/jwa-2.0.0.tgz", 556 "resolved": "https://registry.npmjs.org/jwa/-/jwa-2.0.0.tgz",
...@@ -489,6 +570,14 @@ ...@@ -489,6 +570,14 @@
489 "safe-buffer": "^5.0.1" 570 "safe-buffer": "^5.0.1"
490 } 571 }
491 }, 572 },
573 + "kruptein": {
574 + "version": "2.2.3",
575 + "resolved": "https://registry.npmjs.org/kruptein/-/kruptein-2.2.3.tgz",
576 + "integrity": "sha512-BTwprBPTzkFT9oTugxKd3WnWrX630MqUDsnmBuoa98eQs12oD4n4TeI0GbpdGcYn/73Xueg2rfnw+oK4dovnJg==",
577 + "requires": {
578 + "asn1.js": "^5.4.1"
579 + }
580 + },
492 "lru-cache": { 581 "lru-cache": {
493 "version": "6.0.0", 582 "version": "6.0.0",
494 "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", 583 "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
...@@ -530,6 +619,11 @@ ...@@ -530,6 +619,11 @@
530 "mime-db": "1.47.0" 619 "mime-db": "1.47.0"
531 } 620 }
532 }, 621 },
622 + "minimalistic-assert": {
623 + "version": "1.0.1",
624 + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz",
625 + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A=="
626 + },
533 "minimatch": { 627 "minimatch": {
534 "version": "3.0.4", 628 "version": "3.0.4",
535 "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", 629 "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
...@@ -570,6 +664,11 @@ ...@@ -570,6 +664,11 @@
570 "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", 664 "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz",
571 "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==" 665 "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA=="
572 }, 666 },
667 + "object-assign": {
668 + "version": "4.1.1",
669 + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
670 + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM="
671 + },
573 "on-finished": { 672 "on-finished": {
574 "version": "2.3.0", 673 "version": "2.3.0",
575 "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", 674 "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
...@@ -607,6 +706,11 @@ ...@@ -607,6 +706,11 @@
607 "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", 706 "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz",
608 "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" 707 "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA=="
609 }, 708 },
709 + "random-bytes": {
710 + "version": "1.0.0",
711 + "resolved": "https://registry.npmjs.org/random-bytes/-/random-bytes-1.0.0.tgz",
712 + "integrity": "sha1-T2ih3Arli9P7lYSMMDJNt11kNgs="
713 + },
610 "range-parser": { 714 "range-parser": {
611 "version": "1.2.1", 715 "version": "1.2.1",
612 "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", 716 "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
...@@ -623,6 +727,11 @@ ...@@ -623,6 +727,11 @@
623 "unpipe": "1.0.0" 727 "unpipe": "1.0.0"
624 } 728 }
625 }, 729 },
730 + "retry": {
731 + "version": "0.12.0",
732 + "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz",
733 + "integrity": "sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs="
734 + },
626 "safe-buffer": { 735 "safe-buffer": {
627 "version": "5.1.2", 736 "version": "5.1.2",
628 "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 737 "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
...@@ -664,11 +773,29 @@ ...@@ -664,11 +773,29 @@
664 "send": "0.16.2" 773 "send": "0.16.2"
665 } 774 }
666 }, 775 },
776 + "session-file-store": {
777 + "version": "1.5.0",
778 + "resolved": "https://registry.npmjs.org/session-file-store/-/session-file-store-1.5.0.tgz",
779 + "integrity": "sha512-60IZaJNzyu2tIeHutkYE8RiXVx3KRvacOxfLr2Mj92SIsRIroDsH0IlUUR6fJAjoTW4RQISbaOApa2IZpIwFdQ==",
780 + "requires": {
781 + "bagpipe": "^0.3.5",
782 + "fs-extra": "^8.0.1",
783 + "kruptein": "^2.0.4",
784 + "object-assign": "^4.1.1",
785 + "retry": "^0.12.0",
786 + "write-file-atomic": "3.0.3"
787 + }
788 + },
667 "setprototypeof": { 789 "setprototypeof": {
668 "version": "1.1.0", 790 "version": "1.1.0",
669 "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", 791 "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz",
670 "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" 792 "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ=="
671 }, 793 },
794 + "signal-exit": {
795 + "version": "3.0.3",
796 + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz",
797 + "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA=="
798 + },
672 "statuses": { 799 "statuses": {
673 "version": "1.4.0", 800 "version": "1.4.0",
674 "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", 801 "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz",
...@@ -691,6 +818,27 @@ ...@@ -691,6 +818,27 @@
691 "mime-types": "~2.1.24" 818 "mime-types": "~2.1.24"
692 } 819 }
693 }, 820 },
821 + "typedarray-to-buffer": {
822 + "version": "3.1.5",
823 + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz",
824 + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==",
825 + "requires": {
826 + "is-typedarray": "^1.0.0"
827 + }
828 + },
829 + "uid-safe": {
830 + "version": "2.1.5",
831 + "resolved": "https://registry.npmjs.org/uid-safe/-/uid-safe-2.1.5.tgz",
832 + "integrity": "sha512-KPHm4VL5dDXKz01UuEd88Df+KzynaohSL9fBh096KWAxSKZQDI2uBrVqtvRM4rwrIrRRKsdLNML/lnaaVSRioA==",
833 + "requires": {
834 + "random-bytes": "~1.0.0"
835 + }
836 + },
837 + "universalify": {
838 + "version": "0.1.2",
839 + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
840 + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg=="
841 + },
694 "unpipe": { 842 "unpipe": {
695 "version": "1.0.0", 843 "version": "1.0.0",
696 "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", 844 "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
...@@ -706,6 +854,17 @@ ...@@ -706,6 +854,17 @@
706 "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", 854 "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
707 "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" 855 "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
708 }, 856 },
857 + "write-file-atomic": {
858 + "version": "3.0.3",
859 + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz",
860 + "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==",
861 + "requires": {
862 + "imurmurhash": "^0.1.4",
863 + "is-typedarray": "^1.0.0",
864 + "signal-exit": "^3.0.2",
865 + "typedarray-to-buffer": "^3.1.5"
866 + }
867 + },
709 "yallist": { 868 "yallist": {
710 "version": "4.0.0", 869 "version": "4.0.0",
711 "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", 870 "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
......
...@@ -10,8 +10,10 @@ ...@@ -10,8 +10,10 @@
10 "debug": "~2.6.9", 10 "debug": "~2.6.9",
11 "ejs": "^3.1.6", 11 "ejs": "^3.1.6",
12 "express": "^4.16.4", 12 "express": "^4.16.4",
13 + "express-session": "^1.17.1",
13 "google-auth-library": "^7.0.4", 14 "google-auth-library": "^7.0.4",
14 "http-errors": "~1.6.3", 15 "http-errors": "~1.6.3",
15 - "morgan": "~1.9.1" 16 + "morgan": "~1.9.1",
17 + "session-file-store": "^1.5.0"
16 } 18 }
17 } 19 }
......
...@@ -3,6 +3,14 @@ var router = express.Router(); ...@@ -3,6 +3,14 @@ var router = express.Router();
3 var {OAuth2Client} = require('google-auth-library'); 3 var {OAuth2Client} = require('google-auth-library');
4 var CLIENT_ID = "94679084723-s5f0686p2porp9mkakrp1p89a48n24nj.apps.googleusercontent.com" 4 var CLIENT_ID = "94679084723-s5f0686p2porp9mkakrp1p89a48n24nj.apps.googleusercontent.com"
5 var client= new OAuth2Client(CLIENT_ID); 5 var client= new OAuth2Client(CLIENT_ID);
6 +var session =require('express-session');
7 +var FileStore=require('session-file-store')(session);
8 +router.use(session({
9 + secret: '209', // 암호화
10 + resave: false,
11 + saveUninitialized: true,
12 + store: new FileStore()
13 +}))
6 14
7 /* GET home page. */ 15 /* GET home page. */
8 router.get('/', function(req, res, next) { 16 router.get('/', function(req, res, next) {
...@@ -30,7 +38,16 @@ router.post('/index', (req, res) => { ...@@ -30,7 +38,16 @@ router.post('/index', (req, res) => {
30 38
31 router.get('/login', checkAuthenticated, (req,res )=>{ 39 router.get('/login', checkAuthenticated, (req,res )=>{
32 let user=req.user; 40 let user=req.user;
33 - res.render('login', {user}) 41 + req.session.user=user;
42 + res.render('login', {user:req.session.user})
43 +});
44 +
45 +router.post('/login' ,(req, res)=>{
46 +
47 + console.log(req.body.nickname);
48 + console.log(req.body.age);
49 + console.log(req.body.gender);
50 + return res.render('login', {user:req.session.user})
34 }); 51 });
35 module.exports = router; 52 module.exports = router;
36 53
...@@ -58,7 +75,7 @@ function checkAuthenticated(req, res, next){ ...@@ -58,7 +75,7 @@ function checkAuthenticated(req, res, next){
58 next(); 75 next();
59 }) 76 })
60 .catch(err=>{ 77 .catch(err=>{
61 - res.redirect('/login') 78 + res.redirect('/index')
62 }) 79 })
63 80
64 } 81 }
...\ No newline at end of file ...\ No newline at end of file
......
1 +{"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 ...\ No newline at end of file
...@@ -8,8 +8,22 @@ ...@@ -8,8 +8,22 @@
8 </head> 8 </head>
9 <body> 9 <body>
10 10
11 -<a href="/index" onclick="signOut();">Sign Out</a>
12 <h1>Hi <%= user.name %></h1> 11 <h1>Hi <%= user.name %></h1>
12 +<form method="post">
13 + NickName:<br>
14 + <input type="text" name="nickname" value="MickeyMouse"><br>
15 + Age:<br>
16 + <input type="text" name="age" value="19"><br><br>
17 +
18 + <input type="radio" id="male" name="gender" value="male">
19 + <label for="male">Male</label><br>
20 + <input type="radio" id="female" name="gender" value="female">
21 + <label for="female">Female</label><br>
22 +
23 + <input type="submit" value="Submit">
24 +</form>
25 +<a href="/index" onclick="signOut();">Sign Out</a>
26 +
13 27
14 </body> 28 </body>
15 <script> 29 <script>
......