1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-23 19:53:43 +00:00

add more org reports

This commit is contained in:
Kyle Spearrin
2018-12-14 14:42:04 -05:00
parent 9b7c0288d4
commit ceca4fbe53
10 changed files with 175 additions and 10 deletions

View File

@@ -21,7 +21,7 @@ import { CipherReportComponent } from './cipher-report.component';
export class ReusedPasswordsReportComponent extends CipherReportComponent implements OnInit {
passwordUseMap: Map<string, number>;
constructor(private ciphersService: CipherService, componentFactoryResolver: ComponentFactoryResolver,
constructor(protected cipherService: CipherService, componentFactoryResolver: ComponentFactoryResolver,
messagingService: MessagingService, userService: UserService) {
super(componentFactoryResolver, userService, messagingService, true);
}
@@ -33,7 +33,7 @@ export class ReusedPasswordsReportComponent extends CipherReportComponent implem
}
async setCiphers() {
const allCiphers = await this.ciphersService.getAllDecrypted();
const allCiphers = await this.getAllCiphers();
const ciphersWithPasswords: CipherView[] = [];
this.passwordUseMap = new Map<string, number>();
allCiphers.forEach((c) => {
@@ -51,4 +51,8 @@ export class ReusedPasswordsReportComponent extends CipherReportComponent implem
this.passwordUseMap.has(c.login.password) && this.passwordUseMap.get(c.login.password) > 1);
this.ciphers = reusedPasswordCiphers;
}
protected getAllCiphers(): Promise<CipherView[]> {
return this.cipherService.getAllDecrypted();
}
}

View File

@@ -10,6 +10,8 @@ import { UserService } from 'jslib/abstractions/user.service';
import { CipherType } from 'jslib/enums/cipherType';
import { CipherView } from 'jslib/models/view/cipherView';
import { CipherReportComponent } from './cipher-report.component';
@Component({
@@ -17,7 +19,7 @@ import { CipherReportComponent } from './cipher-report.component';
templateUrl: 'unsecured-websites-report.component.html',
})
export class UnsecuredWebsitesReportComponent extends CipherReportComponent implements OnInit {
constructor(private ciphersService: CipherService, componentFactoryResolver: ComponentFactoryResolver,
constructor(protected cipherService: CipherService, componentFactoryResolver: ComponentFactoryResolver,
messagingService: MessagingService, userService: UserService) {
super(componentFactoryResolver, userService, messagingService, true);
}
@@ -29,7 +31,7 @@ export class UnsecuredWebsitesReportComponent extends CipherReportComponent impl
}
async setCiphers() {
const allCiphers = await this.ciphersService.getAllDecrypted();
const allCiphers = await this.getAllCiphers();
const unsecuredCiphers = allCiphers.filter((c) => {
if (c.type !== CipherType.Login || !c.login.hasUris) {
return false;
@@ -38,4 +40,8 @@ export class UnsecuredWebsitesReportComponent extends CipherReportComponent impl
});
this.ciphers = unsecuredCiphers;
}
protected getAllCiphers(): Promise<CipherView[]> {
return this.cipherService.getAllDecrypted();
}
}

View File

@@ -24,7 +24,7 @@ export class WeakPasswordsReportComponent extends CipherReportComponent implemen
private passwordStrengthCache = new Map<string, number>();
constructor(private ciphersService: CipherService, private passwordGenerationService: PasswordGenerationService,
constructor(protected cipherService: CipherService, protected passwordGenerationService: PasswordGenerationService,
componentFactoryResolver: ComponentFactoryResolver, messagingService: MessagingService,
userService: UserService) {
super(componentFactoryResolver, userService, messagingService, true);
@@ -37,7 +37,7 @@ export class WeakPasswordsReportComponent extends CipherReportComponent implemen
}
async setCiphers() {
const allCiphers = await this.ciphersService.getAllDecrypted();
const allCiphers = await this.getAllCiphers();
const weakPasswordCiphers: CipherView[] = [];
allCiphers.forEach((c) => {
if (c.type !== CipherType.Login || c.login.password == null || c.login.password === '') {
@@ -71,6 +71,10 @@ export class WeakPasswordsReportComponent extends CipherReportComponent implemen
this.ciphers = weakPasswordCiphers;
}
protected getAllCiphers(): Promise<CipherView[]> {
return this.cipherService.getAllDecrypted();
}
private scoreKey(score: number): [string, string] {
switch (score) {
case 4: