mirror of
https://github.com/bitwarden/browser
synced 2026-01-28 07:13:29 +00:00
PM-30799 added html clean up for the domain (#18393)
This commit is contained in:
@@ -522,16 +522,25 @@ export class EventService {
|
||||
break;
|
||||
// Org Domain claiming events
|
||||
case EventType.OrganizationDomain_Added:
|
||||
msg = humanReadableMsg = this.i18nService.t("addedDomain", ev.domainName);
|
||||
msg = humanReadableMsg = this.i18nService.t("addedDomain", this.escapeHtml(ev.domainName));
|
||||
break;
|
||||
case EventType.OrganizationDomain_Removed:
|
||||
msg = humanReadableMsg = this.i18nService.t("removedDomain", ev.domainName);
|
||||
msg = humanReadableMsg = this.i18nService.t(
|
||||
"removedDomain",
|
||||
this.escapeHtml(ev.domainName),
|
||||
);
|
||||
break;
|
||||
case EventType.OrganizationDomain_Verified:
|
||||
msg = humanReadableMsg = this.i18nService.t("domainClaimedEvent", ev.domainName);
|
||||
msg = humanReadableMsg = this.i18nService.t(
|
||||
"domainClaimedEvent",
|
||||
this.escapeHtml(ev.domainName),
|
||||
);
|
||||
break;
|
||||
case EventType.OrganizationDomain_NotVerified:
|
||||
msg = humanReadableMsg = this.i18nService.t("domainNotClaimedEvent", ev.domainName);
|
||||
msg = humanReadableMsg = this.i18nService.t(
|
||||
"domainNotClaimedEvent",
|
||||
this.escapeHtml(ev.domainName),
|
||||
);
|
||||
break;
|
||||
// Secrets Manager
|
||||
case EventType.Secret_Retrieved:
|
||||
@@ -893,6 +902,15 @@ export class EventService {
|
||||
return id?.substring(0, 8);
|
||||
}
|
||||
|
||||
private escapeHtml(unsafe: string): string {
|
||||
if (!unsafe) {
|
||||
return unsafe;
|
||||
}
|
||||
const div = document.createElement("div");
|
||||
div.textContent = unsafe;
|
||||
return div.innerHTML;
|
||||
}
|
||||
|
||||
private toDateTimeLocalString(date: Date) {
|
||||
return (
|
||||
date.getFullYear() +
|
||||
|
||||
Reference in New Issue
Block a user