mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-30 13:03:53 +01:00
exposed passwords report for orgs
This commit is contained in:
parent
7a58f6d967
commit
392a90c02c
2
jslib
2
jslib
@ -1 +1 @@
|
|||||||
Subproject commit e55926336c0fc2362d3aa791dc9fe385d03f6ae8
|
Subproject commit e10523cc6115d94a199f0c3342c5d8040304f7f8
|
@ -33,6 +33,9 @@ import {
|
|||||||
} from './organizations/settings/two-factor-setup.component';
|
} from './organizations/settings/two-factor-setup.component';
|
||||||
|
|
||||||
import { ExportComponent as OrgExportComponent } from './organizations/tools/export.component';
|
import { ExportComponent as OrgExportComponent } from './organizations/tools/export.component';
|
||||||
|
import {
|
||||||
|
ExposedPasswordsReportComponent as OrgExposedPasswordsReportComponent,
|
||||||
|
} from './organizations/tools/exposed-passwords-report.component';
|
||||||
import { ImportComponent as OrgImportComponent } from './organizations/tools/import.component';
|
import { ImportComponent as OrgImportComponent } from './organizations/tools/import.component';
|
||||||
import { ToolsComponent as OrgToolsComponent } from './organizations/tools/tools.component';
|
import { ToolsComponent as OrgToolsComponent } from './organizations/tools/tools.component';
|
||||||
|
|
||||||
@ -198,6 +201,11 @@ const routes: Routes = [
|
|||||||
{ path: '', pathMatch: 'full', redirectTo: 'import' },
|
{ path: '', pathMatch: 'full', redirectTo: 'import' },
|
||||||
{ path: 'import', component: OrgImportComponent, data: { titleId: 'importData' } },
|
{ path: 'import', component: OrgImportComponent, data: { titleId: 'importData' } },
|
||||||
{ path: 'export', component: OrgExportComponent, data: { titleId: 'exportVault' } },
|
{ path: 'export', component: OrgExportComponent, data: { titleId: 'exportVault' } },
|
||||||
|
{
|
||||||
|
path: 'exposed-passwords-report',
|
||||||
|
component: OrgExposedPasswordsReportComponent,
|
||||||
|
data: { titleId: 'exposedPasswordsReport' },
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -63,6 +63,9 @@ import {
|
|||||||
} from './organizations/settings/two-factor-setup.component';
|
} from './organizations/settings/two-factor-setup.component';
|
||||||
|
|
||||||
import { ExportComponent as OrgExportComponent } from './organizations/tools/export.component';
|
import { ExportComponent as OrgExportComponent } from './organizations/tools/export.component';
|
||||||
|
import {
|
||||||
|
ExposedPasswordsReportComponent as OrgExposedPasswordsReportComponent,
|
||||||
|
} from './organizations/tools/exposed-passwords-report.component';
|
||||||
import { ImportComponent as OrgImportComponent } from './organizations/tools/import.component';
|
import { ImportComponent as OrgImportComponent } from './organizations/tools/import.component';
|
||||||
import { ToolsComponent as OrgToolsComponent } from './organizations/tools/tools.component';
|
import { ToolsComponent as OrgToolsComponent } from './organizations/tools/tools.component';
|
||||||
|
|
||||||
@ -252,6 +255,7 @@ registerLocaleData(localeZhCn, 'zh-CN');
|
|||||||
OrgEntityUsersComponent,
|
OrgEntityUsersComponent,
|
||||||
OrgEventsComponent,
|
OrgEventsComponent,
|
||||||
OrgExportComponent,
|
OrgExportComponent,
|
||||||
|
OrgExposedPasswordsReportComponent,
|
||||||
OrgImportComponent,
|
OrgImportComponent,
|
||||||
OrgGroupAddEditComponent,
|
OrgGroupAddEditComponent,
|
||||||
OrgGroupingsComponent,
|
OrgGroupingsComponent,
|
||||||
|
@ -0,0 +1,39 @@
|
|||||||
|
import {
|
||||||
|
Component,
|
||||||
|
ComponentFactoryResolver,
|
||||||
|
} from '@angular/core';
|
||||||
|
import { ActivatedRoute } from '@angular/router';
|
||||||
|
|
||||||
|
import { AuditService } from 'jslib/abstractions/audit.service';
|
||||||
|
import { CipherService } from 'jslib/abstractions/cipher.service';
|
||||||
|
import { MessagingService } from 'jslib/abstractions/messaging.service';
|
||||||
|
import { UserService } from 'jslib/abstractions/user.service';
|
||||||
|
|
||||||
|
import {
|
||||||
|
ExposedPasswordsReportComponent as BaseExposedPasswordsReportComponent,
|
||||||
|
} from '../../tools/exposed-passwords-report.component';
|
||||||
|
|
||||||
|
import { CipherView } from 'jslib/models/view/cipherView';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-exposed-passwords-report',
|
||||||
|
templateUrl: '../../tools/exposed-passwords-report.component.html',
|
||||||
|
})
|
||||||
|
export class ExposedPasswordsReportComponent extends BaseExposedPasswordsReportComponent {
|
||||||
|
constructor(ciphersService: CipherService, auditService: AuditService,
|
||||||
|
componentFactoryResolver: ComponentFactoryResolver, messagingService: MessagingService,
|
||||||
|
userService: UserService, private route: ActivatedRoute) {
|
||||||
|
super(ciphersService, auditService, componentFactoryResolver, messagingService, userService);
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.route.parent.parent.params.subscribe(async (params) => {
|
||||||
|
this.organization = await this.userService.getOrganization(params.organizationId);
|
||||||
|
super.ngOnInit();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
getAllCiphers(): Promise<CipherView[]> {
|
||||||
|
return this.cipherService.getAllFromApiForOrganization(this.organization.id);
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
<div class="container page-content">
|
<div class="container page-content">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-3">
|
<div class="col-3">
|
||||||
<div class="card">
|
<div class="card mb-4">
|
||||||
<div class="card-header">{{'tools' | i18n}}</div>
|
<div class="card-header">{{'tools' | i18n}}</div>
|
||||||
<div class="list-group list-group-flush">
|
<div class="list-group list-group-flush">
|
||||||
<a routerLink="import" class="list-group-item" routerLinkActive="active">
|
<a routerLink="import" class="list-group-item" routerLinkActive="active">
|
||||||
@ -12,6 +12,28 @@
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="card" *ngIf="accessReports">
|
||||||
|
<div class="card-header">
|
||||||
|
{{'reports' | i18n}}
|
||||||
|
</div>
|
||||||
|
<div class="list-group list-group-flush">
|
||||||
|
<a routerLink="exposed-passwords-report" class="list-group-item" routerLinkActive="active">
|
||||||
|
{{'exposedPasswordsReport' | i18n}}
|
||||||
|
</a>
|
||||||
|
<a routerLink="reused-passwords-report" class="list-group-item" routerLinkActive="active">
|
||||||
|
{{'reusedPasswordsReport' | i18n}}
|
||||||
|
</a>
|
||||||
|
<a routerLink="weak-passwords-report" class="list-group-item" routerLinkActive="active">
|
||||||
|
{{'weakPasswordsReport' | i18n}}
|
||||||
|
</a>
|
||||||
|
<a routerLink="unsecured-websites-report" class="list-group-item" routerLinkActive="active">
|
||||||
|
{{'unsecuredWebsitesReport' | i18n}}
|
||||||
|
</a>
|
||||||
|
<a routerLink="inactive-two-factor-report" class="list-group-item" routerLinkActive="active">
|
||||||
|
{{'inactive2faReport' | i18n}}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-9">
|
<div class="col-9">
|
||||||
<router-outlet></router-outlet>
|
<router-outlet></router-outlet>
|
||||||
|
@ -1,7 +1,27 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
import { ActivatedRoute } from '@angular/router';
|
||||||
|
|
||||||
|
import { Organization } from 'jslib/models/domain/organization';
|
||||||
|
|
||||||
|
import { UserService } from 'jslib/abstractions/user.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-org-tools',
|
selector: 'app-org-tools',
|
||||||
templateUrl: 'tools.component.html',
|
templateUrl: 'tools.component.html',
|
||||||
})
|
})
|
||||||
export class ToolsComponent { }
|
export class ToolsComponent {
|
||||||
|
organization: Organization;
|
||||||
|
accessReports = false;
|
||||||
|
|
||||||
|
constructor(private route: ActivatedRoute, private userService: UserService) { }
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.route.parent.params.subscribe(async (params) => {
|
||||||
|
this.organization = await this.userService.getOrganization(params.organizationId);
|
||||||
|
// TODO: Maybe we want to just make sure they are not on a free plan? Just compare use2fa for now
|
||||||
|
// since all paid plans include use2fa
|
||||||
|
this.accessReports = this.organization.use2fa;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -45,21 +45,7 @@ export class CiphersComponent extends BaseCiphersComponent {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.accessEvents = this.organization.useEvents;
|
this.accessEvents = this.organization.useEvents;
|
||||||
const ciphers = await this.apiService.getCiphersOrganization(this.organization.id);
|
this.allCiphers = await this.cipherService.getAllFromApiForOrganization(this.organization.id);
|
||||||
if (ciphers != null && ciphers.data != null && ciphers.data.length) {
|
|
||||||
const decCiphers: CipherView[] = [];
|
|
||||||
const promises: any[] = [];
|
|
||||||
ciphers.data.forEach((r) => {
|
|
||||||
const data = new CipherData(r);
|
|
||||||
const cipher = new Cipher(data);
|
|
||||||
promises.push(cipher.decrypt().then((c) => decCiphers.push(c)));
|
|
||||||
});
|
|
||||||
await Promise.all(promises);
|
|
||||||
decCiphers.sort(this.cipherService.getLocaleSortingFunction());
|
|
||||||
this.allCiphers = decCiphers;
|
|
||||||
} else {
|
|
||||||
this.allCiphers = [];
|
|
||||||
}
|
|
||||||
this.applyFilter(filter);
|
this.applyFilter(filter);
|
||||||
this.loaded = true;
|
this.loaded = true;
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,10 @@ import {
|
|||||||
|
|
||||||
import { CipherView } from 'jslib/models/view/cipherView';
|
import { CipherView } from 'jslib/models/view/cipherView';
|
||||||
|
|
||||||
|
import { Organization } from 'jslib/models/domain/organization';
|
||||||
|
|
||||||
import { ModalComponent } from '../modal.component';
|
import { ModalComponent } from '../modal.component';
|
||||||
|
import { AddEditComponent as OrgAddEditComponent } from '../organizations/vault/add-edit.component';
|
||||||
import { AddEditComponent } from '../vault/add-edit.component';
|
import { AddEditComponent } from '../vault/add-edit.component';
|
||||||
|
|
||||||
import { MessagingService } from 'jslib/abstractions/messaging.service';
|
import { MessagingService } from 'jslib/abstractions/messaging.service';
|
||||||
@ -18,11 +21,12 @@ export class CipherReportComponent {
|
|||||||
loading = false;
|
loading = false;
|
||||||
hasLoaded = false;
|
hasLoaded = false;
|
||||||
ciphers: CipherView[] = [];
|
ciphers: CipherView[] = [];
|
||||||
|
organization: Organization;
|
||||||
|
|
||||||
private modal: ModalComponent = null;
|
private modal: ModalComponent = null;
|
||||||
|
|
||||||
constructor(private componentFactoryResolver: ComponentFactoryResolver, protected userService: UserService,
|
constructor(private componentFactoryResolver: ComponentFactoryResolver, protected userService: UserService,
|
||||||
protected messagingService: MessagingService, public requiresPremium: boolean) { }
|
protected messagingService: MessagingService, public requiresPaid: boolean) { }
|
||||||
|
|
||||||
async load() {
|
async load() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
@ -38,10 +42,18 @@ export class CipherReportComponent {
|
|||||||
|
|
||||||
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
|
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
|
||||||
this.modal = this.cipherAddEditModalRef.createComponent(factory).instance;
|
this.modal = this.cipherAddEditModalRef.createComponent(factory).instance;
|
||||||
const childComponent = this.modal.show<AddEditComponent>(
|
let childComponent: OrgAddEditComponent | AddEditComponent;
|
||||||
AddEditComponent, this.cipherAddEditModalRef);
|
if (this.organization != null) {
|
||||||
|
childComponent = this.modal.show<OrgAddEditComponent>(OrgAddEditComponent, this.cipherAddEditModalRef);
|
||||||
|
(childComponent as OrgAddEditComponent).organization = this.organization;
|
||||||
|
} else {
|
||||||
|
childComponent = this.modal.show<AddEditComponent>(AddEditComponent, this.cipherAddEditModalRef);
|
||||||
|
}
|
||||||
|
|
||||||
childComponent.cipherId = cipher == null ? null : cipher.id;
|
childComponent.cipherId = cipher == null ? null : cipher.id;
|
||||||
|
if (this.organization != null) {
|
||||||
|
childComponent.organizationId = this.organization.id;
|
||||||
|
}
|
||||||
childComponent.onSavedCipher.subscribe(async (c: CipherView) => {
|
childComponent.onSavedCipher.subscribe(async (c: CipherView) => {
|
||||||
this.modal.close();
|
this.modal.close();
|
||||||
await this.load();
|
await this.load();
|
||||||
@ -58,12 +70,21 @@ export class CipherReportComponent {
|
|||||||
return childComponent;
|
return childComponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async checkPremium(): Promise<boolean> {
|
protected async checkAccess(): Promise<boolean> {
|
||||||
const accessPremium = await this.userService.canAccessPremium();
|
if (this.organization != null) {
|
||||||
if (this.requiresPremium && !accessPremium) {
|
// TODO: Maybe we want to just make sure they are not on a free plan? Just compare use2fa for now
|
||||||
this.messagingService.send('premiumRequired');
|
// since all paid plans include use2fa
|
||||||
this.loading = false;
|
if (this.requiresPaid && !this.organization.use2fa) {
|
||||||
return false;
|
this.messagingService.send('upgradeOrganization', { organizationId: this.organization.id });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const accessPremium = await this.userService.canAccessPremium();
|
||||||
|
if (this.requiresPaid && !accessPremium) {
|
||||||
|
this.messagingService.send('premiumRequired');
|
||||||
|
this.loading = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -22,24 +22,24 @@ import { CipherReportComponent } from './cipher-report.component';
|
|||||||
export class ExposedPasswordsReportComponent extends CipherReportComponent implements OnInit {
|
export class ExposedPasswordsReportComponent extends CipherReportComponent implements OnInit {
|
||||||
exposedPasswordMap = new Map<string, number>();
|
exposedPasswordMap = new Map<string, number>();
|
||||||
|
|
||||||
constructor(private ciphersService: CipherService, private auditService: AuditService,
|
constructor(protected cipherService: CipherService, protected auditService: AuditService,
|
||||||
componentFactoryResolver: ComponentFactoryResolver, messagingService: MessagingService,
|
componentFactoryResolver: ComponentFactoryResolver, messagingService: MessagingService,
|
||||||
userService: UserService) {
|
userService: UserService) {
|
||||||
super(componentFactoryResolver, userService, messagingService, true);
|
super(componentFactoryResolver, userService, messagingService, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.checkPremium();
|
this.checkAccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
async load() {
|
async load() {
|
||||||
if (await this.checkPremium()) {
|
if (await this.checkAccess()) {
|
||||||
super.load();
|
super.load();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async setCiphers() {
|
async setCiphers() {
|
||||||
const allCiphers = await this.ciphersService.getAllDecrypted();
|
const allCiphers = await this.getAllCiphers();
|
||||||
const exposedPasswordCiphers: CipherView[] = [];
|
const exposedPasswordCiphers: CipherView[] = [];
|
||||||
const promises: Array<Promise<void>> = [];
|
const promises: Array<Promise<void>> = [];
|
||||||
allCiphers.forEach((c) => {
|
allCiphers.forEach((c) => {
|
||||||
@ -57,4 +57,8 @@ export class ExposedPasswordsReportComponent extends CipherReportComponent imple
|
|||||||
await Promise.all(promises);
|
await Promise.all(promises);
|
||||||
this.ciphers = exposedPasswordCiphers;
|
this.ciphers = exposedPasswordCiphers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected getAllCiphers(): Promise<CipherView[]> {
|
||||||
|
return this.cipherService.getAllDecrypted();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ export class InactiveTwoFactorReportComponent extends CipherReportComponent impl
|
|||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
if (await this.checkPremium()) {
|
if (await this.checkAccess()) {
|
||||||
await super.load();
|
await super.load();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ export class ReusedPasswordsReportComponent extends CipherReportComponent implem
|
|||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
if (await this.checkPremium()) {
|
if (await this.checkAccess()) {
|
||||||
await super.load();
|
await super.load();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ export class UnsecuredWebsitesReportComponent extends CipherReportComponent impl
|
|||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
if (await this.checkPremium()) {
|
if (await this.checkAccess()) {
|
||||||
await super.load();
|
await super.load();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ export class WeakPasswordsReportComponent extends CipherReportComponent implemen
|
|||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
if (await this.checkPremium()) {
|
if (await this.checkAccess()) {
|
||||||
await super.load();
|
await super.load();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user