mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-22 16:36:15 -04:00
SessionStore: Improve cookie expiration check
* Don't mutate `sess.cookie.expires`. * Allow `sess.cookie` to be nullish. * Always compare `Date` objects.
This commit is contained in:
parent
928c598ecf
commit
4d498725c7
2 changed files with 5 additions and 9 deletions
|
@ -11,12 +11,8 @@ class SessionStore extends Store {
|
|||
async _get(sid) {
|
||||
logger.debug(`GET ${sid}`);
|
||||
const s = await DB.get(`sessionstorage:${sid}`);
|
||||
if (!s) return;
|
||||
if (typeof s.cookie.expires === 'string') s.cookie.expires = new Date(s.cookie.expires);
|
||||
if (s.cookie.expires && new Date() >= s.cookie.expires) {
|
||||
await this._destroy(sid);
|
||||
return;
|
||||
}
|
||||
const {cookie: {expires} = {}} = s || {};
|
||||
if (expires && new Date() >= new Date(expires)) return await this._destroy(sid);
|
||||
return s;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue