SessionManager: Fix session expiration check

This bug was introduced in 8b0baa9679.

(cherry picked from commit 3886e95c83)
This commit is contained in:
Richard Hansen 2020-09-19 15:51:55 -04:00
parent df7fa1fd41
commit 2249b9ae19

View file

@ -72,7 +72,7 @@ exports.findAuthorID = async (groupID, sessionCookie) => {
return undefined; return undefined;
}); });
const now = Math.floor(Date.now() / 1000); const now = Math.floor(Date.now() / 1000);
const isMatch = (si) => (si != null && si.groupID === groupID && si.validUntil <= now); const isMatch = (si) => (si != null && si.groupID === groupID && now < si.validUntil);
const sessionInfo = await promises.firstSatisfies(sessionInfoPromises, isMatch); const sessionInfo = await promises.firstSatisfies(sessionInfoPromises, isMatch);
if (sessionInfo == null) return undefined; if (sessionInfo == null) return undefined;
return sessionInfo.authorID; return sessionInfo.authorID;