mirror of
https://github.com/bitwarden/browser
synced 2026-02-08 20:50:28 +00:00
Render at risk notification (from revert).
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
// FIXME: Update this file to be type safe and remove this and next line
|
||||
// @ts-strict-ignore
|
||||
import { Subject, switchMap, timer } from "rxjs";
|
||||
import { firstValueFrom, Subject, switchMap, timer } from "rxjs";
|
||||
|
||||
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
|
||||
import { getOptionalUserId } from "@bitwarden/common/auth/services/account.service";
|
||||
import { CLEAR_NOTIFICATION_LOGIN_DATA_DURATION } from "@bitwarden/common/autofill/constants";
|
||||
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
||||
import { UserId } from "@bitwarden/common/types/guid";
|
||||
@@ -445,6 +446,30 @@ export class OverlayNotificationsBackground implements OverlayNotificationsBackg
|
||||
this.clearCompletedWebRequest(requestId, tab);
|
||||
return;
|
||||
}
|
||||
|
||||
const activeUserId = await firstValueFrom(
|
||||
this.accountService.activeAccount$.pipe(getOptionalUserId),
|
||||
);
|
||||
const { cipher, securityTask } = await this.getSecurityTaskAndCipherForLoginData(
|
||||
modifyLoginData,
|
||||
activeUserId,
|
||||
);
|
||||
const shouldTriggerAtRiskPasswordNotification: boolean = typeof securityTask !== "undefined";
|
||||
|
||||
if (shouldTriggerAtRiskPasswordNotification) {
|
||||
await this.notificationBackground.openAtRisksPasswordNotification(
|
||||
{
|
||||
command: "bgOpenAtRisksPasswordNotification",
|
||||
data: {
|
||||
activeUserId,
|
||||
cipher,
|
||||
securityTask,
|
||||
},
|
||||
},
|
||||
{ tab },
|
||||
);
|
||||
this.clearCompletedWebRequest(requestId, tab);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,6 +7,7 @@ import type { FolderView } from "@bitwarden/common/vault/models/view/folder.view
|
||||
import { AdjustNotificationBarMessageData } from "../background/abstractions/notification.background";
|
||||
import { NotificationCipherData } from "../content/components/cipher/types";
|
||||
import { CollectionView, OrgView } from "../content/components/common-types";
|
||||
import { AtRiskNotification } from "../content/components/notification/at-risk-password/container";
|
||||
import { NotificationConfirmationContainer } from "../content/components/notification/confirmation/container";
|
||||
import { NotificationContainer } from "../content/components/notification/container";
|
||||
import { selectedFolder as selectedFolderSignal } from "../content/components/signals/selected-folder";
|
||||
@@ -176,6 +177,22 @@ async function initNotificationBar(message: NotificationBarWindowMessage) {
|
||||
);
|
||||
}
|
||||
|
||||
// Handle AtRiskPasswordNotification render
|
||||
if (notificationBarIframeInitData.type === NotificationTypes.AtRiskPassword) {
|
||||
return render(
|
||||
AtRiskNotification({
|
||||
...notificationBarIframeInitData,
|
||||
type: notificationBarIframeInitData.type as NotificationType,
|
||||
theme: resolvedTheme,
|
||||
i18n,
|
||||
params: initData.params,
|
||||
handleCloseNotification,
|
||||
}),
|
||||
document.body,
|
||||
);
|
||||
}
|
||||
|
||||
// Default scenario: add or update password
|
||||
const orgId = selectedVaultSignal.get();
|
||||
|
||||
await Promise.all([
|
||||
|
||||
Reference in New Issue
Block a user