[FIX] Logging out from other clients (#23276)

pull/22392/head
Diego Sampaio 4 years ago committed by GitHub
parent cd2ce2a862
commit 249105d984
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/2fa/server/functions/resetTOTP.ts
  2. 2
      app/api/server/v1/users.js
  3. 10
      app/models/server/models/Users.js
  4. 6
      app/models/server/raw/Users.js
  5. 2
      server/lib/resetUserE2EKey.ts

@ -60,7 +60,7 @@ export async function resetTOTP(userId: string, notifyUser = false): Promise<boo
const result = await Users.resetTOTPById(userId);
if (result?.modifiedCount === 1) {
await Users.removeResumeService(userId);
await Users.unsetLoginTokens(userId);
return true;
}

@ -925,7 +925,7 @@ API.v1.addRoute('users.logout', { authRequired: true }, {
}
// this method logs the user out automatically, if successful returns 1, otherwise 0
if (!Users.removeResumeService(userId)) {
if (!Users.unsetLoginTokens(userId)) {
throw new Meteor.Error('error-invalid-user-id', 'Invalid user id');
}

@ -1461,16 +1461,6 @@ export class Users extends Base {
return this.update({ _id }, update);
}
removeResumeService(_id) {
const update = {
$unset: {
'services.resume': '',
},
};
return this.update({ _id }, update);
}
removeSamlServiceSession(_id) {
const update = {
$unset: {

@ -674,12 +674,12 @@ export class UsersRaw extends BaseRaw {
});
}
removeResumeService(userId) {
unsetLoginTokens(userId) {
return this.col.updateOne({
_id: userId,
}, {
$unset: {
'services.resume': 1,
$set: {
'services.resume.loginTokens': [],
},
});
}

@ -61,7 +61,7 @@ export function resetUserE2EEncriptionKey(uid: string, notifyUser: boolean): boo
Subscriptions.resetUserE2EKey(uid);
// Force the user to logout, so that the keys can be generated again
Users.removeResumeService(uid);
Users.unsetLoginTokens(uid);
return true;
}

Loading…
Cancel
Save