diff --git a/routes/sis.js b/routes/sis.js index 2bd1ff8..b0ddf23 100644 --- a/routes/sis.js +++ b/routes/sis.js @@ -13,7 +13,7 @@ module.exports = function(app, api, auth) { app.post("/login", (req,res) => api.login(req.query.user, req.query.pass, (err, cookie, name) => { if (!err) { - if (cookie[0].startsWith("SESSID=;")) res.send("No SESSID returned"); + if (cookie[0].startsWith("SESSID=;")) res.status(403).send("No SESSID returned"); else api.get_current_term((err, term) => { var reply = new Object(); reply.term = term; -- 2.51.2 From ea01f3e553d29e38c984bfb5136b37fd70561615 Mon Sep 17 00:00:00 2001 From: Chris Vanderloo Date: Tue, 12 Feb 2019 00:24:05 -0500 Subject: [PATCH 2/3] removed unnecessary session function middleware --- api.js | 1 + routes/sis.js | 7 ------- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/api.js b/api.js index 3d2811d..2b3261a 100644 --- a/api.js +++ b/api.js @@ -1,4 +1,5 @@ var request = require("request"); +// use a single request object in order to hold cookies in session request = request.defaults({jar: true}); const sources = require('./sources.json'); diff --git a/routes/sis.js b/routes/sis.js index b0ddf23..1d97596 100644 --- a/routes/sis.js +++ b/routes/sis.js @@ -1,10 +1,3 @@ -// SIS middleware to verify SESSID exists on authorized paths -function auth(req,res,next) { - if (req.cookies.sessid !== "" && req.cookies.sessid) { - next(); - } - else res.status(403).send("Requires SESSID"); -} module.exports = function(app, api, auth) { -- 2.51.2 From 45b99e9815bddc2b1f41ef209435289f1ae1c483 Mon Sep 17 00:00:00 2001 From: Chris Vanderloo Date: Tue, 12 Feb 2019 22:08:15 -0500 Subject: [PATCH 3/3] Added server handshake --- index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/index.js b/index.js index 5ade0f4..e8f1d20 100644 --- a/index.js +++ b/index.js @@ -14,6 +14,12 @@ require('./routes/yacs.js')(app, api.yacs); // SIS require('./routes/sis.js')(app, api.sis); +// handshake +app.get("/verify_status", (req, res) => { + console.log("Client handshake"); + res.send({ status: 'active' }); +}); + // SERVER app.listen(8080, () => {