mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-30 13:03:53 +01:00
ensure that message is for proper logged in user
This commit is contained in:
parent
45da8aa9eb
commit
a72843af3e
@ -26,7 +26,8 @@ export class NotificationResponse {
|
|||||||
case NotificationType.SyncCiphers:
|
case NotificationType.SyncCiphers:
|
||||||
case NotificationType.SyncOrgKeys:
|
case NotificationType.SyncOrgKeys:
|
||||||
case NotificationType.SyncSettings:
|
case NotificationType.SyncSettings:
|
||||||
this.payload = new SyncUserNotification(payload);
|
case NotificationType.LogOut:
|
||||||
|
this.payload = new UserNotification(payload);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -62,7 +63,7 @@ export class SyncFolderNotification {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SyncUserNotification {
|
export class UserNotification {
|
||||||
userId: string;
|
userId: string;
|
||||||
date: Date;
|
date: Date;
|
||||||
|
|
||||||
|
@ -107,6 +107,13 @@ export class NotificationsService implements NotificationsServiceAbstraction {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isAuthenticated = await this.userService.isAuthenticated();
|
||||||
|
const payloadUserId = notification.payload.userId || notification.payload.UserId;
|
||||||
|
const myUserId = await this.userService.getUserId();
|
||||||
|
if (isAuthenticated && payloadUserId != null && payloadUserId !== myUserId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (notification.type) {
|
switch (notification.type) {
|
||||||
case NotificationType.SyncCipherCreate:
|
case NotificationType.SyncCipherCreate:
|
||||||
case NotificationType.SyncCipherUpdate:
|
case NotificationType.SyncCipherUpdate:
|
||||||
@ -128,16 +135,22 @@ export class NotificationsService implements NotificationsServiceAbstraction {
|
|||||||
case NotificationType.SyncVault:
|
case NotificationType.SyncVault:
|
||||||
case NotificationType.SyncCiphers:
|
case NotificationType.SyncCiphers:
|
||||||
case NotificationType.SyncSettings:
|
case NotificationType.SyncSettings:
|
||||||
|
if (isAuthenticated) {
|
||||||
await this.syncService.fullSync(false);
|
await this.syncService.fullSync(false);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case NotificationType.SyncOrgKeys:
|
case NotificationType.SyncOrgKeys:
|
||||||
|
if (isAuthenticated) {
|
||||||
await this.apiService.refreshIdentityToken();
|
await this.apiService.refreshIdentityToken();
|
||||||
await this.syncService.fullSync(true);
|
await this.syncService.fullSync(true);
|
||||||
// Stop so a reconnect can be made
|
// Stop so a reconnect can be made
|
||||||
await this.signalrConnection.stop();
|
await this.signalrConnection.stop();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case NotificationType.LogOut:
|
case NotificationType.LogOut:
|
||||||
|
if (isAuthenticated) {
|
||||||
this.logoutCallback();
|
this.logoutCallback();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user