diff --git a/apps/web/src/app/tools/reports/pages/exposed-passwords-report.component.html b/apps/web/src/app/tools/reports/pages/exposed-passwords-report.component.html index 09c717e913..43701dcd71 100644 --- a/apps/web/src/app/tools/reports/pages/exposed-passwords-report.component.html +++ b/apps/web/src/app/tools/reports/pages/exposed-passwords-report.component.html @@ -27,12 +27,14 @@ - + - {{ "name" | i18n }} - {{ "owner" | i18n }} - + {{ "name" | i18n }} + + {{ "owner" | i18n }} + + @@ -74,7 +76,7 @@
{{ r.subTitle }} - + - {{ "exposedXTimes" | i18n: (exposedPasswordMap.get(r.id) | number) }} + {{ "exposedXTimes" | i18n: (r.exposedXTimes | number) }} diff --git a/apps/web/src/app/tools/reports/pages/exposed-passwords-report.component.ts b/apps/web/src/app/tools/reports/pages/exposed-passwords-report.component.ts index 8503174a93..13d2804c5e 100644 --- a/apps/web/src/app/tools/reports/pages/exposed-passwords-report.component.ts +++ b/apps/web/src/app/tools/reports/pages/exposed-passwords-report.component.ts @@ -11,12 +11,14 @@ import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; import { PasswordRepromptService } from "@bitwarden/vault"; import { CipherReportComponent } from "./cipher-report.component"; + +type ReportResult = CipherView & { exposedXTimes: number }; + @Component({ selector: "app-exposed-passwords-report", templateUrl: "exposed-passwords-report.component.html", }) export class ExposedPasswordsReportComponent extends CipherReportComponent implements OnInit { - exposedPasswordMap = new Map(); disabled = true; constructor( @@ -44,12 +46,12 @@ export class ExposedPasswordsReportComponent extends CipherReportComponent imple async setCiphers() { const allCiphers = await this.getAllCiphers(); - const exposedPasswordCiphers: CipherView[] = []; + const exposedPasswordCiphers: ReportResult[] = []; const promises: Promise[] = []; this.filterStatus = [0]; - allCiphers.forEach((ciph: any) => { - const { type, login, isDeleted, edit, viewPassword, id } = ciph; + allCiphers.forEach((ciph) => { + const { type, login, isDeleted, edit, viewPassword } = ciph; if ( type !== CipherType.Login || login.password == null || @@ -63,8 +65,8 @@ export class ExposedPasswordsReportComponent extends CipherReportComponent imple const promise = this.auditService.passwordLeaked(login.password).then((exposedCount) => { if (exposedCount > 0) { - exposedPasswordCiphers.push(ciph); - this.exposedPasswordMap.set(id, exposedCount); + const row = { ...ciph, exposedXTimes: exposedCount } as ReportResult; + exposedPasswordCiphers.push(row); } }); promises.push(promise); @@ -72,6 +74,7 @@ export class ExposedPasswordsReportComponent extends CipherReportComponent imple await Promise.all(promises); this.filterCiphersByOrg(exposedPasswordCiphers); + this.dataSource.sort = { column: "exposedXTimes", direction: "desc" }; } protected canManageCipher(c: CipherView): boolean {