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

fix: Break session for testing purpose (WEBAPP-4973) #3145

Merged
merged 2 commits into from Apr 12, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions app/script/util/DebugUtil.js
Expand Up @@ -37,7 +37,8 @@ z.util.DebugUtil = class DebugUtil {

breakSession(userId, clientId) {
const sessionId = `${userId}@${clientId}`;
return wire.app.repository.cryptography.cryptobox
const cryptobox = wire.app.repository.cryptography.cryptobox;
return cryptobox
.session_load(sessionId)
.then(cryptoboxSession => {
cryptoboxSession.session.session_states = {};
Expand All @@ -50,8 +51,9 @@ z.util.DebugUtil = class DebugUtil {
};

const sessionStoreName = z.storage.StorageSchemata.OBJECT_STORE.SESSIONS;
return wire.app.repository.storage.storageService.save(sessionStoreName, sessionId, record);
return wire.app.repository.storage.storageService.updateOrCreate(sessionStoreName, sessionId, record);
})
.then(() => cryptobox.cachedSessions.delete(sessionId))
.then(() => this.logger.log(`Corrupted Session ID '${sessionId}'`));
}

Expand Down