From a587c1d1dae107030be7dd26900f4027edc7c406 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 12 Dec 2018 10:34:05 -0500 Subject: [PATCH] async the weak password checks --- src/app/tools/weak-passwords-report.component.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/app/tools/weak-passwords-report.component.ts b/src/app/tools/weak-passwords-report.component.ts index e9d4478588..eb5e99b08f 100644 --- a/src/app/tools/weak-passwords-report.component.ts +++ b/src/app/tools/weak-passwords-report.component.ts @@ -37,16 +37,22 @@ export class WeakPasswordsReportComponent extends CipherReportComponent implemen async setCiphers() { const allCiphers = await this.ciphersService.getAllDecrypted(); const weakPasswordCiphers: CipherView[] = []; + const promises: Array> = []; allCiphers.forEach((c) => { if (c.type !== CipherType.Login || c.login.password == null || c.login.password === '') { return; } - const result = this.passwordGenerationService.passwordStrength(c.login.password); - if (result.score <= 3) { - this.passwordStrengthMap.set(c.id, this.scoreKey(result.score)); - weakPasswordCiphers.push(c); - } + const promise = new Promise((resolve) => { + const result = this.passwordGenerationService.passwordStrength(c.login.password); + if (result.score <= 3) { + this.passwordStrengthMap.set(c.id, this.scoreKey(result.score)); + weakPasswordCiphers.push(c); + } + resolve(); + }); + promises.push(promise); }); + await Promise.all(promises); this.ciphers = weakPasswordCiphers; }