Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GDPR5 #1411

Merged
merged 1 commit into from
Jun 11, 2018
Merged

GDPR5 #1411

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 4 additions & 16 deletions libs/modifySessions.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,7 @@ exports.remove = function (aReq, aUser, aCallback) {
var pos = aUser && aUser.sessionIds ?
aUser.sessionIds.indexOf(aReq.sessionID) : -1;

if (aReq.session.destroy) {
aReq.session.destroy();
} else { // TODO: Remove conditional and this fallback when satisifed
delete aReq.session.user;
}
aReq.session.destroy();

if (pos > -1) {
aUser.sessionIds.splice(pos, 1);
Expand Down Expand Up @@ -124,24 +120,16 @@ exports.update = function (aReq, aUser, aCallback) {
}, aCallback);
};

// Destory all sessions for a user
// Destroy all sessions for a user
exports.destroy = function (aReq, aUser, aCallback) {
var store = aReq.sessionStore;
var emptySess = {
cookie: {
path: '/',
_expires: null,
originalMaxAge: null,
httpOnly: true
}
};

if (!aUser || !aUser.sessionIds) {
aCallback('No sessions', null);
return;
}

async.each(aUser.sessionIds, function (aId, aCb) {
store.set(aId, emptySess, aCb);
async.each(aUser.sessionIds, function (aId, aInnerCallback) {
store.destroy(aId, aInnerCallback);
}, aCallback);
};