From 024de53f1874640b81385d7b1f72e95e51559f14 Mon Sep 17 00:00:00 2001 From: Yutsuo Date: Tue, 8 Jan 2019 13:04:25 -0200 Subject: [PATCH] Phase III Task 4 --- nginx/html/nay.html | 6 ++++-- nginx/html/test.html | 13 ------------- nginx/html/yay.html | 27 +++++++++++++++++++++++++-- node/app.js | 7 ++++++- node/package.json | 2 +- 5 files changed, 36 insertions(+), 19 deletions(-) diff --git a/nginx/html/nay.html b/nginx/html/nay.html index bcdbc07..4f4c178 100644 --- a/nginx/html/nay.html +++ b/nginx/html/nay.html @@ -1,9 +1,11 @@ + + +

THOUS HAST FAILED

-

BEGONE FROM MY LAIR, MORTAL

+

BEGONE FROM MY LAIR, MORTAL

- \ No newline at end of file diff --git a/nginx/html/test.html b/nginx/html/test.html index 6f1bdcf..1b1b76c 100644 --- a/nginx/html/test.html +++ b/nginx/html/test.html @@ -1,17 +1,4 @@ - + +

THOUS HAST SUCCEEDED

-

THOU ART LOGGED

+

THOU ART LOGGED

+
+
+

Also if you see the message below you have access to resctricted content:

+

- \ No newline at end of file diff --git a/node/app.js b/node/app.js index 7896188..7b8c735 100755 --- a/node/app.js +++ b/node/app.js @@ -13,7 +13,8 @@ const jwt = require('jsonwebtoken'); const bodyParser= require('body-parser'); const secret = 'wowmuchsecretveryhiddenwow'; const cookieParser = require('cookie-parser'); -const cookie = require('cookie'); +const Cookies = require('cookies'); +const cookies = new Cookies(); const successUrl = 'http://localhost:3002/yay.html'; const failureUrl = 'http://localhost:3002/nay.html'; @@ -131,6 +132,9 @@ app.get('/cookie', function(req, res, next) { console.log(cookieArray[1]); console.log('\x1b[35m', 'cookieArray[2] below:'); console.log(cookieArray[2]); + console.log('\x1b[35m', 'cookies.get() below:'); + cookies.set('test','test'); + console.log(cookies.get('test')); }); // Test endpoint for md files rendering @@ -223,6 +227,7 @@ app.use('/restricted', restrictedRoutes); restrictedRoutes.use(function (req, res, next) { let sentToken = req.headers['token']; + // let sentToken = if (sentToken) { jwt.verify(sentToken, secret, function (err, decoded) { if (err) { diff --git a/node/package.json b/node/package.json index a52b114..33102b1 100755 --- a/node/package.json +++ b/node/package.json @@ -22,7 +22,7 @@ "body-parser": "^1.18.3", "jsonwebtoken": "^8.4.0", "morgan": "^1.9.1", - "cookie": "^0.3.1", + "cookies": "^0.7.3", "cookie-parser": "^1.4.3" } }