Skip to content

Commit d58b8f8

Browse files
authored
GDPR5 (#1411)
* Destroy session instead of just blanking out the User object *(and cookie)* \*confused as to why this was done but pre-me joining\* * This is another session leak discovered last week and is our current orphan from #1409... will clean up in a while * One comment typo that's been elusive every time I want to fix it NOTES: * Now satisfied with "logout" destroy as it seems to be working well every test... so removed fallback * "There... is... another... \*gasp\*" * Yoda *(working on twiddling to create a fix for it)* Related to #604 #1201 and #1393
1 parent b48dd88 commit d58b8f8

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

libs/modifySessions.js

+4-16
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,7 @@ exports.remove = function (aReq, aUser, aCallback) {
8686
var pos = aUser && aUser.sessionIds ?
8787
aUser.sessionIds.indexOf(aReq.sessionID) : -1;
8888

89-
if (aReq.session.destroy) {
90-
aReq.session.destroy();
91-
} else { // TODO: Remove conditional and this fallback when satisifed
92-
delete aReq.session.user;
93-
}
89+
aReq.session.destroy();
9490

9591
if (pos > -1) {
9692
aUser.sessionIds.splice(pos, 1);
@@ -124,24 +120,16 @@ exports.update = function (aReq, aUser, aCallback) {
124120
}, aCallback);
125121
};
126122

127-
// Destory all sessions for a user
123+
// Destroy all sessions for a user
128124
exports.destroy = function (aReq, aUser, aCallback) {
129125
var store = aReq.sessionStore;
130-
var emptySess = {
131-
cookie: {
132-
path: '/',
133-
_expires: null,
134-
originalMaxAge: null,
135-
httpOnly: true
136-
}
137-
};
138126

139127
if (!aUser || !aUser.sessionIds) {
140128
aCallback('No sessions', null);
141129
return;
142130
}
143131

144-
async.each(aUser.sessionIds, function (aId, aCb) {
145-
store.set(aId, emptySess, aCb);
132+
async.each(aUser.sessionIds, function (aId, aInnerCallback) {
133+
store.destroy(aId, aInnerCallback);
146134
}, aCallback);
147135
};

0 commit comments

Comments
 (0)