From f0172f7d3ce3f18186f628c4040cf1cfe67f0727 Mon Sep 17 00:00:00 2001 From: be beet <63141491+beetcb@users.noreply.github.com> Date: Tue, 30 Mar 2021 23:29:03 +0800 Subject: [PATCH] fix: make cookie vaildation reasonable --- campusphere/app.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/campusphere/app.js b/campusphere/app.js index 65ca0b4..99342f9 100644 --- a/campusphere/app.js +++ b/campusphere/app.js @@ -28,6 +28,10 @@ exports.signApp = class signApp extends campusphereApp { process.env[user.username] = user } + /** + * @param {*} cookie stored cookie + * @return {boolean} true if cookie is invalid + */ async signInfo(cookie) { const user = process.env[this.id] if (!cookie) { @@ -42,7 +46,8 @@ exports.signApp = class signApp extends campusphereApp { headers, body: JSON.stringify({}), }) - if (res.headers.hasOwnProperty('set-cookie')) return true + // TODO: handle the responsed updated cookie + if (!res.ok) return true const signQ = await res.json() this.curTask = signQ.datas.unSignedTasks[0] return false