From fa4e5250b9656b1da5d1849d092a9d2f27f74368 Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Fri, 27 Aug 2021 14:50:58 +0200 Subject: [PATCH] Add show/hide button to password prompt (#1034) --- .../providers/clients/clients.component.ts | 43 ++-- .../app/providers/manage/people.component.ts | 130 ++++-------- jslib | 2 +- src/app/accounts/two-factor.component.ts | 38 ++-- src/app/common/base.people.component.ts | 42 ++-- .../password-reprompt.component.html | 39 ++++ .../components/password-reprompt.component.ts | 8 + src/app/modal.component.ts | 76 ------- .../manage/collections.component.ts | 73 +++---- .../organizations/manage/groups.component.ts | 70 +++---- .../organizations/manage/people.component.ts | 189 ++++++----------- .../manage/policies.component.ts | 38 ++-- .../settings/account.component.ts | 98 +++------ .../settings/two-factor-setup.component.ts | 15 +- .../exposed-passwords-report.component.ts | 11 +- .../inactive-two-factor-report.component.ts | 11 +- .../reused-passwords-report.component.ts | 11 +- .../unsecured-websites-report.component.ts | 11 +- .../tools/weak-passwords-report.component.ts | 11 +- .../organizations/vault/vault.component.html | 2 +- .../organizations/vault/vault.component.ts | 139 +++++------- src/app/oss.module.ts | 5 +- src/app/send/send.component.ts | 45 ++-- src/app/services/modal.service.ts | 61 ++++++ src/app/services/services.module.ts | 8 +- src/app/settings/account.component.ts | 108 +++------- .../emergency-access-view.component.ts | 43 +--- .../settings/emergency-access.component.ts | 112 ++++------ .../settings/two-factor-setup.component.ts | 38 ++-- src/app/tools/cipher-report.component.ts | 59 ++---- .../exposed-passwords-report.component.ts | 7 +- .../inactive-two-factor-report.component.ts | 7 +- src/app/tools/password-generator.component.ts | 21 +- .../reused-passwords-report.component.ts | 7 +- .../unsecured-websites-report.component.ts | 7 +- .../tools/weak-passwords-report.component.ts | 7 +- src/app/vault/bulk-actions.component.ts | 104 +++------ src/app/vault/vault.component.html | 2 +- src/app/vault/vault.component.ts | 198 ++++++------------ src/services/passwordReprompt.service.ts | 9 + src/services/webPlatformUtils.service.ts | 26 --- 41 files changed, 697 insertions(+), 1234 deletions(-) create mode 100644 src/app/components/password-reprompt.component.html create mode 100644 src/app/components/password-reprompt.component.ts delete mode 100644 src/app/modal.component.ts create mode 100644 src/app/services/modal.service.ts create mode 100644 src/services/passwordReprompt.service.ts diff --git a/bitwarden_license/src/app/providers/clients/clients.component.ts b/bitwarden_license/src/app/providers/clients/clients.component.ts index 312fec54..2bf7c1d1 100644 --- a/bitwarden_license/src/app/providers/clients/clients.component.ts +++ b/bitwarden_license/src/app/providers/clients/clients.component.ts @@ -1,6 +1,5 @@ import { Component, - ComponentFactoryResolver, OnInit, ViewChild, ViewContainerRef @@ -15,18 +14,17 @@ import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.se import { SearchService } from 'jslib-common/abstractions/search.service'; import { UserService } from 'jslib-common/abstractions/user.service'; +import { ModalService } from 'jslib-angular/services/modal.service'; +import { ValidationService } from 'jslib-angular/services/validation.service'; + import { PlanType } from 'jslib-common/enums/planType'; import { ProviderUserType } from 'jslib-common/enums/providerUserType'; -import { ValidationService } from 'jslib-angular/services/validation.service'; - import { Organization } from 'jslib-common/models/domain/organization'; import { ProviderOrganizationOrganizationDetailsResponse } from 'jslib-common/models/response/provider/providerOrganizationResponse'; -import { ModalComponent } from 'src/app/modal.component'; - import { ProviderService } from '../services/provider.service'; import { AddOrganizationComponent } from './add-organization.component'; @@ -49,7 +47,6 @@ export class ClientsComponent implements OnInit { clients: ProviderOrganizationOrganizationDetailsResponse[]; pagedClients: ProviderOrganizationOrganizationDetailsResponse[]; - modal: ModalComponent; protected didScroll = false; protected pageSize = 100; @@ -60,8 +57,8 @@ export class ClientsComponent implements OnInit { private apiService: ApiService, private searchService: SearchService, private platformUtilsService: PlatformUtilsService, private i18nService: I18nService, private toasterService: ToasterService, private validationService: ValidationService, - private providerService: ProviderService, private componentFactoryResolver: ComponentFactoryResolver, - private logService: LogService) { } + private providerService: ProviderService, private logService: LogService, + private modalService: ModalService) { } async ngOnInit() { this.route.parent.params.subscribe(async params => { @@ -126,24 +123,18 @@ export class ClientsComponent implements OnInit { this.didScroll = this.pagedClients.length > this.pageSize; } - addExistingOrganization() { - const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent); - this.modal = this.addModalRef.createComponent(factory).instance; - const childComponent = this.modal.show(AddOrganizationComponent, this.addModalRef); - - childComponent.providerId = this.providerId; - childComponent.organizations = this.addableOrganizations; - childComponent.onAddedOrganization.subscribe(async () => { - try { - await this.load(); - this.modal.close(); - } catch (e) { - this.logService.error(`Handled exception: ${e}`); - } - }); - - this.modal.onClosed.subscribe(() => { - this.modal = null; + async addExistingOrganization() { + const [modal, childComponent] = await this.modalService.openViewRef(AddOrganizationComponent, this.addModalRef, comp => { + comp.providerId = this.providerId; + comp.organizations = this.addableOrganizations; + comp.onAddedOrganization.subscribe(async () => { + try { + await this.load(); + modal.close(); + } catch (e) { + this.logService.error(`Handled exception: ${e}`); + } + }); }); } diff --git a/bitwarden_license/src/app/providers/manage/people.component.ts b/bitwarden_license/src/app/providers/manage/people.component.ts index 6741f99c..304ebc5c 100644 --- a/bitwarden_license/src/app/providers/manage/people.component.ts +++ b/bitwarden_license/src/app/providers/manage/people.component.ts @@ -1,6 +1,5 @@ import { Component, - ComponentFactoryResolver, OnInit, ViewChild, ViewContainerRef @@ -17,6 +16,7 @@ import { SearchService } from 'jslib-common/abstractions/search.service'; import { StorageService } from 'jslib-common/abstractions/storage.service'; import { UserService } from 'jslib-common/abstractions/user.service'; +import { ModalService } from 'jslib-angular/services/modal.service'; import { ValidationService } from 'jslib-angular/services/validation.service'; import { ProviderUserStatusType } from 'jslib-common/enums/providerUserStatusType'; @@ -33,7 +33,6 @@ import { ProviderUserConfirmRequest } from 'jslib-common/models/request/provider import { ProviderUserBulkResponse } from 'jslib-common/models/response/provider/providerUserBulkResponse'; import { BasePeopleComponent } from 'src/app/common/base.people.component'; -import { ModalComponent } from 'src/app/modal.component'; import { BulkStatusComponent } from 'src/app/organizations/manage/bulk/bulk-status.component'; import { EntityEventsComponent } from 'src/app/organizations/manage/entity-events.component'; import { BulkConfirmComponent } from './bulk/bulk-confirm.component'; @@ -59,13 +58,13 @@ export class PeopleComponent extends BasePeopleComponent( - UserAddEditComponent, this.addEditModalRef); - - childComponent.name = this.userNamePipe.transform(user); - childComponent.providerId = this.providerId; - childComponent.providerUserId = user != null ? user.id : null; - childComponent.onSavedUser.subscribe(() => { - this.modal.close(); - this.load(); - }); - childComponent.onDeletedUser.subscribe(() => { - this.modal.close(); - this.removeUser(user); - }); - - this.modal.onClosed.subscribe(() => { - this.modal = null; + async edit(user: ProviderUserUserDetailsResponse) { + const [modal] = await this.modalService.openViewRef(UserAddEditComponent, this.addEditModalRef, comp => { + comp.name = this.userNamePipe.transform(user); + comp.providerId = this.providerId; + comp.providerUserId = user != null ? user.id : null; + comp.onSavedUser.subscribe(() => { + modal.close(); + this.load(); + }); + comp.onDeletedUser.subscribe(() => { + modal.close(); + this.removeUser(user); + }); }); } async events(user: ProviderUserUserDetailsResponse) { - if (this.modal != null) { - this.modal.close(); - } - - const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent); - this.modal = this.eventsModalRef.createComponent(factory).instance; - const childComponent = this.modal.show( - EntityEventsComponent, this.eventsModalRef); - - childComponent.name = this.userNamePipe.transform(user); - childComponent.providerId = this.providerId; - childComponent.entityId = user.id; - childComponent.showUser = false; - childComponent.entity = 'user'; - - this.modal.onClosed.subscribe(() => { - this.modal = null; + const [modal] = await this.modalService.openViewRef(EntityEventsComponent, this.eventsModalRef, comp => { + comp.name = this.userNamePipe.transform(user); + comp.providerId = this.providerId; + comp.entityId = user.id; + comp.showUser = false; + comp.entity = 'user'; }); } @@ -170,21 +147,13 @@ export class PeopleComponent extends BasePeopleComponent { - await this.load(); - this.modal = null; + const [modal] = await this.modalService.openViewRef(BulkRemoveComponent, this.bulkRemoveModalRef, comp => { + comp.providerId = this.providerId; + comp.users = this.getCheckedUsers(); }); + + await modal.onClosedPromise(); + await this.load(); } async bulkReinvite() { @@ -216,49 +185,34 @@ export class PeopleComponent extends BasePeopleComponent { - await this.load(); - this.modal = null; + const [modal] = await this.modalService.openViewRef(BulkConfirmComponent, this.bulkConfirmModalRef, comp => { + comp.providerId = this.providerId; + comp.users = this.getCheckedUsers(); }); + + await modal.onClosedPromise(); + await this.load(); } private async showBulkStatus(users: ProviderUserUserDetailsResponse[], filteredUsers: ProviderUserUserDetailsResponse[], request: Promise>, successfullMessage: string) { - const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent); - this.modal = this.bulkStatusModalRef.createComponent(factory).instance; - const childComponent = this.modal.show( - BulkStatusComponent, this.bulkStatusModalRef); - - childComponent.loading = true; + const [modal, childComponent] = await this.modalService.openViewRef(BulkStatusComponent, this.bulkStatusModalRef, comp => { + comp.loading = true; + }); // Workaround to handle closing the modal shortly after it has been opened let close = false; - this.modal.onShown.subscribe(() => { + modal.onShown.subscribe(() => { if (close) { - this.modal.close(); + modal.close(); } }); - this.modal.onClosed.subscribe(() => { - this.modal = null; - }); - try { const response = await request; - if (this.modal) { + if (modal) { const keyedErrors: any = response.data.filter(r => r.error !== '').reduce((a, x) => ({ ...a, [x.id]: x.error }), {}); const keyedFilteredUsers: any = filteredUsers.reduce((a, x) => ({ ...a, [x.id]: x }), {}); @@ -278,9 +232,7 @@ export class PeopleComponent extends BasePeopleComponent(TwoFactorOptionsComponent, - this.twoFactorOptionsModal); - - childComponent.onProviderSelected.subscribe(async (provider: TwoFactorProviderType) => { - modal.close(); - this.selectedProviderType = provider; - await this.init(); - }); - childComponent.onRecoverSelected.subscribe(() => { - modal.close(); + async anotherMethod() { + const [modal] = await this.modalService.openViewRef(TwoFactorOptionsComponent, this.twoFactorOptionsModal, comp => { + comp.onProviderSelected.subscribe(async (provider: TwoFactorProviderType) => { + modal.close(); + this.selectedProviderType = provider; + await this.init(); + }); + comp.onRecoverSelected.subscribe(() => { + modal.close(); + }); }); } diff --git a/src/app/common/base.people.component.ts b/src/app/common/base.people.component.ts index e6ba3f32..c38ac0d2 100644 --- a/src/app/common/base.people.component.ts +++ b/src/app/common/base.people.component.ts @@ -1,5 +1,4 @@ import { - ComponentFactoryResolver, Directive, ViewChild, ViewContainerRef @@ -17,6 +16,8 @@ import { StorageService } from 'jslib-common/abstractions/storage.service'; import { ConstantsService } from 'jslib-common/services/constants.service'; +import { ModalService } from 'jslib-angular/services/modal.service'; + import { SearchPipe } from 'jslib-angular/pipes/search.pipe'; import { UserNamePipe } from 'jslib-angular/pipes/user-name.pipe'; @@ -31,7 +32,6 @@ import { ProviderUserUserDetailsResponse } from 'jslib-common/models/response/pr import { Utils } from 'jslib-common/misc/utils'; -import { ModalComponent } from '../modal.component'; import { UserConfirmComponent } from '../organizations/manage/user-confirm.component'; type StatusType = OrganizationUserStatusType | ProviderUserStatusType; @@ -86,7 +86,6 @@ export abstract class BasePeopleComponent(ConstantsService.autoConfirmFingerprints); if (autoConfirm == null || !autoConfirm) { - if (this.modal != null) { - this.modal.close(); - } - - const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent); - this.modal = this.confirmModalRef.createComponent(factory).instance; - const childComponent = this.modal.show( - UserConfirmComponent, this.confirmModalRef); - - childComponent.name = this.userNamePipe.transform(user); - childComponent.userId = user != null ? user.userId : null; - childComponent.publicKey = publicKey; - childComponent.onConfirmedUser.subscribe(async () => { - try { - await confirmUser(publicKey); - this.modal.close(); - } catch (e) { - this.logService.error(`Handled exception: ${e}`); - } - }); - - this.modal.onClosed.subscribe(() => { - this.modal = null; + const [modal] = await this.modalService.openViewRef(UserConfirmComponent, this.confirmModalRef, comp => { + comp.name = this.userNamePipe.transform(user); + comp.userId = user != null ? user.userId : null; + comp.publicKey = publicKey; + comp.onConfirmedUser.subscribe(async () => { + try { + await confirmUser(publicKey); + modal.close(); + } catch (e) { + this.logService.error(`Handled exception: ${e}`); + } + }); }); return; } diff --git a/src/app/components/password-reprompt.component.html b/src/app/components/password-reprompt.component.html new file mode 100644 index 00000000..6bf635f3 --- /dev/null +++ b/src/app/components/password-reprompt.component.html @@ -0,0 +1,39 @@ + diff --git a/src/app/components/password-reprompt.component.ts b/src/app/components/password-reprompt.component.ts new file mode 100644 index 00000000..b3204f94 --- /dev/null +++ b/src/app/components/password-reprompt.component.ts @@ -0,0 +1,8 @@ +import { Component } from '@angular/core'; + +import { PasswordRepromptComponent as BasePasswordRepromptComponent } from 'jslib-angular/components/password-reprompt.component'; + +@Component({ + templateUrl: 'password-reprompt.component.html', +}) +export class PasswordRepromptComponent extends BasePasswordRepromptComponent {} diff --git a/src/app/modal.component.ts b/src/app/modal.component.ts deleted file mode 100644 index 6fa184c0..00000000 --- a/src/app/modal.component.ts +++ /dev/null @@ -1,76 +0,0 @@ -import * as jq from 'jquery'; - -import { - Component, - ComponentFactoryResolver, - Type, - ViewContainerRef, -} from '@angular/core'; - -import { ModalComponent as BaseModalComponent } from 'jslib-angular/components/modal.component'; -import { Utils } from 'jslib-common/misc/utils'; - -import { MessagingService } from 'jslib-common/abstractions/messaging.service'; - -@Component({ - selector: 'app-modal', - template: ``, -}) -export class ModalComponent extends BaseModalComponent { - el: any = null; - - constructor(componentFactoryResolver: ComponentFactoryResolver, messagingService: MessagingService) { - super(componentFactoryResolver, messagingService); - } - - ngOnDestroy() { /* Nothing */ } - - show(type: Type, parentContainer: ViewContainerRef, fade: boolean = true, - setComponentParameters: (component: T) => void = null): T { - this.parentContainer = parentContainer; - this.fade = fade; - - const factory = this.componentFactoryResolver.resolveComponentFactory(type); - const componentRef = this.container.createComponent(factory); - if (setComponentParameters != null) { - setComponentParameters(componentRef.instance); - } - - const modals = Array.from(document.querySelectorAll('.modal')); - if (modals.length > 0) { - this.el = jq(modals[0]); - this.el.modal('show'); - - this.el.on('show.bs.modal', () => { - this.onShow.emit(); - this.messagingService.send('modalShow'); - }); - this.el.on('shown.bs.modal', () => { - this.onShown.emit(); - this.messagingService.send('modalShown'); - if (!Utils.isMobileBrowser) { - this.el.find('*[appAutoFocus]').focus(); - } - }); - this.el.on('hide.bs.modal', () => { - this.onClose.emit(); - this.messagingService.send('modalClose'); - }); - this.el.on('hidden.bs.modal', () => { - this.onClosed.emit(); - this.messagingService.send('modalClosed'); - if (this.parentContainer != null) { - this.parentContainer.clear(); - } - }); - } - - return componentRef.instance; - } - - close() { - if (this.el != null) { - this.el.modal('hide'); - } - } -} diff --git a/src/app/organizations/manage/collections.component.ts b/src/app/organizations/manage/collections.component.ts index 4b9fbdad..0f148c6d 100644 --- a/src/app/organizations/manage/collections.component.ts +++ b/src/app/organizations/manage/collections.component.ts @@ -1,12 +1,10 @@ import { Component, - ComponentFactoryResolver, OnInit, ViewChild, ViewContainerRef, } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; - import { ToasterService } from 'angular2-toaster'; import { ApiService } from 'jslib-common/abstractions/api.service'; @@ -16,6 +14,8 @@ import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.se import { SearchService } from 'jslib-common/abstractions/search.service'; import { UserService } from 'jslib-common/abstractions/user.service'; +import { ModalService } from 'jslib-angular/services/modal.service'; + import { CollectionData } from 'jslib-common/models/data/collectionData'; import { Collection } from 'jslib-common/models/domain/collection'; import { @@ -25,7 +25,6 @@ import { import { ListResponse } from 'jslib-common/models/response/listResponse'; import { CollectionView } from 'jslib-common/models/view/collectionView'; -import { ModalComponent } from '../../modal.component'; import { CollectionAddEditComponent } from './collection-add-edit.component'; import { EntityUsersComponent } from './entity-users.component'; @@ -47,10 +46,9 @@ export class CollectionsComponent implements OnInit { protected pageSize = 100; private pagedCollectionsCount = 0; - private modal: ModalComponent = null; constructor(private apiService: ApiService, private route: ActivatedRoute, - private collectionService: CollectionService, private componentFactoryResolver: ComponentFactoryResolver, + private collectionService: CollectionService, private modalService: ModalService, private toasterService: ToasterService, private i18nService: I18nService, private platformUtilsService: PlatformUtilsService, private userService: UserService, private searchService: SearchService) { } @@ -100,29 +98,18 @@ export class CollectionsComponent implements OnInit { this.didScroll = this.pagedCollections.length > this.pageSize; } - edit(collection: CollectionView) { - if (this.modal != null) { - this.modal.close(); - } - - const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent); - this.modal = this.addEditModalRef.createComponent(factory).instance; - const childComponent = this.modal.show( - CollectionAddEditComponent, this.addEditModalRef); - - childComponent.organizationId = this.organizationId; - childComponent.collectionId = collection != null ? collection.id : null; - childComponent.onSavedCollection.subscribe(() => { - this.modal.close(); - this.load(); - }); - childComponent.onDeletedCollection.subscribe(() => { - this.modal.close(); - this.removeCollection(collection); - }); - - this.modal.onClosed.subscribe(() => { - this.modal = null; + async edit(collection: CollectionView) { + const [modal] = await this.modalService.openViewRef(CollectionAddEditComponent, this.addEditModalRef, comp => { + comp.organizationId = this.organizationId; + comp.collectionId = collection != null ? collection.id : null; + comp.onSavedCollection.subscribe(() => { + modal.close(); + this.load(); + }); + comp.onDeletedCollection.subscribe(() => { + modal.close(); + this.removeCollection(collection); + }); }); } @@ -145,27 +132,17 @@ export class CollectionsComponent implements OnInit { } catch { } } - users(collection: CollectionView) { - if (this.modal != null) { - this.modal.close(); - } + async users(collection: CollectionView) { + const [modal] = await this.modalService.openViewRef(EntityUsersComponent, this.usersModalRef, comp => { + comp.organizationId = this.organizationId; + comp.entity = 'collection'; + comp.entityId = collection.id; + comp.entityName = collection.name; - const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent); - this.modal = this.usersModalRef.createComponent(factory).instance; - const childComponent = this.modal.show( - EntityUsersComponent, this.usersModalRef); - - childComponent.organizationId = this.organizationId; - childComponent.entity = 'collection'; - childComponent.entityId = collection.id; - childComponent.entityName = collection.name; - - childComponent.onEditedUsers.subscribe(() => { - this.load(); - this.modal.close(); - }); - this.modal.onClosed.subscribe(() => { - this.modal = null; + comp.onEditedUsers.subscribe(() => { + this.load(); + modal.close(); + }); }); } diff --git a/src/app/organizations/manage/groups.component.ts b/src/app/organizations/manage/groups.component.ts index bcd311c4..ff188eb3 100644 --- a/src/app/organizations/manage/groups.component.ts +++ b/src/app/organizations/manage/groups.component.ts @@ -1,6 +1,5 @@ import { Component, - ComponentFactoryResolver, OnInit, ViewChild, ViewContainerRef, @@ -18,11 +17,12 @@ import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.se import { SearchService } from 'jslib-common/abstractions/search.service'; import { UserService } from 'jslib-common/abstractions/user.service'; +import { ModalService } from 'jslib-angular/services/modal.service'; + import { GroupResponse } from 'jslib-common/models/response/groupResponse'; import { Utils } from 'jslib-common/misc/utils'; -import { ModalComponent } from '../../modal.component'; import { EntityUsersComponent } from './entity-users.component'; import { GroupAddEditComponent } from './group-add-edit.component'; @@ -44,10 +44,9 @@ export class GroupsComponent implements OnInit { protected pageSize = 100; private pagedGroupsCount = 0; - private modal: ModalComponent = null; constructor(private apiService: ApiService, private route: ActivatedRoute, - private i18nService: I18nService, private componentFactoryResolver: ComponentFactoryResolver, + private i18nService: I18nService, private modalService: ModalService, private toasterService: ToasterService, private platformUtilsService: PlatformUtilsService, private userService: UserService, private router: Router, private searchService: SearchService) { } @@ -95,29 +94,18 @@ export class GroupsComponent implements OnInit { this.didScroll = this.pagedGroups.length > this.pageSize; } - edit(group: GroupResponse) { - if (this.modal != null) { - this.modal.close(); - } - - const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent); - this.modal = this.addEditModalRef.createComponent(factory).instance; - const childComponent = this.modal.show( - GroupAddEditComponent, this.addEditModalRef); - - childComponent.organizationId = this.organizationId; - childComponent.groupId = group != null ? group.id : null; - childComponent.onSavedGroup.subscribe(() => { - this.modal.close(); - this.load(); - }); - childComponent.onDeletedGroup.subscribe(() => { - this.modal.close(); - this.removeGroup(group); - }); - - this.modal.onClosed.subscribe(() => { - this.modal = null; + async edit(group: GroupResponse) { + const [modal] = await this.modalService.openViewRef(GroupAddEditComponent, this.addEditModalRef, comp => { + comp.organizationId = this.organizationId; + comp.groupId = group != null ? group.id : null; + comp.onSavedGroup.subscribe(() => { + modal.close(); + this.load(); + }); + comp.onDeletedGroup.subscribe(() => { + modal.close(); + this.removeGroup(group); + }); }); } @@ -140,26 +128,16 @@ export class GroupsComponent implements OnInit { } catch { } } - users(group: GroupResponse) { - if (this.modal != null) { - this.modal.close(); - } + async users(group: GroupResponse) { + const [modal] = await this.modalService.openViewRef(EntityUsersComponent, this.usersModalRef, comp => { + comp.organizationId = this.organizationId; + comp.entity = 'group'; + comp.entityId = group.id; + comp.entityName = group.name; - const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent); - this.modal = this.usersModalRef.createComponent(factory).instance; - const childComponent = this.modal.show( - EntityUsersComponent, this.usersModalRef); - - childComponent.organizationId = this.organizationId; - childComponent.entity = 'group'; - childComponent.entityId = group.id; - childComponent.entityName = group.name; - - childComponent.onEditedUsers.subscribe(() => { - this.modal.close(); - }); - this.modal.onClosed.subscribe(() => { - this.modal = null; + comp.onEditedUsers.subscribe(() => { + modal.close(); + }); }); } diff --git a/src/app/organizations/manage/people.component.ts b/src/app/organizations/manage/people.component.ts index 4394c01a..572aae63 100644 --- a/src/app/organizations/manage/people.component.ts +++ b/src/app/organizations/manage/people.component.ts @@ -1,6 +1,5 @@ import { Component, - ComponentFactoryResolver, OnInit, ViewChild, ViewContainerRef, @@ -26,6 +25,8 @@ import { StorageService } from 'jslib-common/abstractions/storage.service'; import { SyncService } from 'jslib-common/abstractions/sync.service'; import { UserService } from 'jslib-common/abstractions/user.service'; +import { ModalService } from 'jslib-angular/services/modal.service'; + import { OrganizationKeysRequest } from 'jslib-common/models/request/organizationKeysRequest'; import { OrganizationUserBulkRequest } from 'jslib-common/models/request/organizationUserBulkRequest'; import { OrganizationUserConfirmRequest } from 'jslib-common/models/request/organizationUserConfirmRequest'; @@ -37,13 +38,11 @@ import { OrganizationUserUserDetailsResponse } from 'jslib-common/models/respons import { OrganizationUserStatusType } from 'jslib-common/enums/organizationUserStatusType'; import { OrganizationUserType } from 'jslib-common/enums/organizationUserType'; import { PolicyType } from 'jslib-common/enums/policyType'; -import { ProviderUserType } from 'jslib-common/enums/providerUserType'; import { SearchPipe } from 'jslib-angular/pipes/search.pipe'; import { UserNamePipe } from 'jslib-angular/pipes/user-name.pipe'; import { BasePeopleComponent } from '../../common/base.people.component'; -import { ModalComponent } from '../../modal.component'; import { BulkConfirmComponent } from './bulk/bulk-confirm.component'; import { BulkRemoveComponent } from './bulk/bulk-remove.component'; import { BulkStatusComponent } from './bulk/bulk-status.component'; @@ -80,14 +79,14 @@ export class PeopleComponent extends BasePeopleComponent( - UserAddEditComponent, this.addEditModalRef); - - childComponent.name = this.userNamePipe.transform(user); - childComponent.organizationId = this.organizationId; - childComponent.organizationUserId = user != null ? user.id : null; - childComponent.onSavedUser.subscribe(() => { - this.modal.close(); - this.load(); - }); - childComponent.onDeletedUser.subscribe(() => { - this.modal.close(); - this.removeUser(user); - }); - - this.modal.onClosed.subscribe(() => { - this.modal = null; + async edit(user: OrganizationUserUserDetailsResponse) { + const [modal] = await this.modalService.openViewRef(UserAddEditComponent, this.addEditModalRef, comp => { + comp.name = this.userNamePipe.transform(user); + comp.organizationId = this.organizationId; + comp.organizationUserId = user != null ? user.id : null; + comp.onSavedUser.subscribe(() => { + modal.close(); + this.load(); + }); + comp.onDeletedUser.subscribe(() => { + modal.close(); + this.removeUser(user); + }); }); } - groups(user: OrganizationUserUserDetailsResponse) { - if (this.modal != null) { - this.modal.close(); - } - - const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent); - this.modal = this.groupsModalRef.createComponent(factory).instance; - const childComponent = this.modal.show( - UserGroupsComponent, this.groupsModalRef); - - childComponent.name = this.userNamePipe.transform(user); - childComponent.organizationId = this.organizationId; - childComponent.organizationUserId = user != null ? user.id : null; - childComponent.onSavedUser.subscribe(() => { - this.modal.close(); - }); - - this.modal.onClosed.subscribe(() => { - this.modal = null; + async groups(user: OrganizationUserUserDetailsResponse) { + const [modal] = await this.modalService.openViewRef(UserGroupsComponent, this.groupsModalRef, comp => { + comp.name = this.userNamePipe.transform(user); + comp.organizationId = this.organizationId; + comp.organizationUserId = user != null ? user.id : null; + comp.onSavedUser.subscribe(() => { + modal.close(); + }); }); } @@ -243,21 +220,13 @@ export class PeopleComponent extends BasePeopleComponent { - await this.load(); - this.modal = null; + const [modal] = await this.modalService.openViewRef(BulkRemoveComponent, this.bulkRemoveModalRef, comp => { + comp.organizationId = this.organizationId; + comp.users = this.getCheckedUsers(); }); + + await modal.onClosedPromise(); + await this.load(); } async bulkReinvite() { @@ -274,7 +243,6 @@ export class PeopleComponent extends BasePeopleComponent user.id)); const response = this.apiService.postManyOrganizationUserReinvite(this.organizationId, request); @@ -290,95 +258,58 @@ export class PeopleComponent extends BasePeopleComponent { - await this.load(); - this.modal = null; + const [modal] = await this.modalService.openViewRef(BulkConfirmComponent, this.bulkConfirmModalRef, comp => { + comp.organizationId = this.organizationId; + comp.users = this.getCheckedUsers(); }); + + await modal.onClosedPromise(); + await this.load(); } async events(user: OrganizationUserUserDetailsResponse) { - if (this.modal != null) { - this.modal.close(); - } - - const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent); - this.modal = this.eventsModalRef.createComponent(factory).instance; - const childComponent = this.modal.show( - EntityEventsComponent, this.eventsModalRef); - - childComponent.name = this.userNamePipe.transform(user); - childComponent.organizationId = this.organizationId; - childComponent.entityId = user.id; - childComponent.showUser = false; - childComponent.entity = 'user'; - - this.modal.onClosed.subscribe(() => { - this.modal = null; + const [modal] = await this.modalService.openViewRef(EntityEventsComponent, this.eventsModalRef, comp => { + comp.name = this.userNamePipe.transform(user); + comp.organizationId = this.organizationId; + comp.entityId = user.id; + comp.showUser = false; + comp.entity = 'user'; }); } async resetPassword(user: OrganizationUserUserDetailsResponse) { - if (this.modal != null) { - this.modal.close(); - } + const [modal] = await this.modalService.openViewRef(ResetPasswordComponent, this.resetPasswordModalRef, comp => { + comp.name = this.userNamePipe.transform(user); + comp.email = user != null ? user.email : null; + comp.organizationId = this.organizationId; + comp.id = user != null ? user.id : null; - const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent); - this.modal = this.resetPasswordModalRef.createComponent(factory).instance; - const childComponent = this.modal.show( - ResetPasswordComponent, this.resetPasswordModalRef); - - childComponent.name = this.userNamePipe.transform(user); - childComponent.email = user != null ? user.email : null; - childComponent.organizationId = this.organizationId; - childComponent.id = user != null ? user.id : null; - - childComponent.onPasswordReset.subscribe(() => { - this.modal.close(); - this.load(); - }); - - this.modal.onClosed.subscribe(() => { - this.modal = null; + comp.onPasswordReset.subscribe(() => { + modal.close(); + this.load(); + }); }); } private async showBulkStatus(users: OrganizationUserUserDetailsResponse[], filteredUsers: OrganizationUserUserDetailsResponse[], request: Promise>, successfullMessage: string) { - const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent); - this.modal = this.bulkStatusModalRef.createComponent(factory).instance; - const childComponent = this.modal.show( - BulkStatusComponent, this.bulkStatusModalRef); - - childComponent.loading = true; + const [modal, childComponent] = await this.modalService.openViewRef(BulkStatusComponent, this.bulkStatusModalRef, comp => { + comp.loading = true; + }); // Workaround to handle closing the modal shortly after it has been opened let close = false; - this.modal.onShown.subscribe(() => { + modal.onShown.subscribe(() => { if (close) { - this.modal.close(); + modal.close(); } }); - this.modal.onClosed.subscribe(() => { - this.modal = null; - }); - try { const response = await request; - if (this.modal) { + if (modal) { const keyedErrors: any = response.data.filter(r => r.error !== '').reduce((a, x) => ({ ...a, [x.id]: x.error }), {}); const keyedFilteredUsers: any = filteredUsers.reduce((a, x) => ({ ...a, [x.id]: x }), {}); @@ -398,9 +329,7 @@ export class PeopleComponent extends BasePeopleComponent = new Map(); constructor(private apiService: ApiService, private route: ActivatedRoute, - private i18nService: I18nService, private componentFactoryResolver: ComponentFactoryResolver, + private i18nService: I18nService, private modalService: ModalService, private platformUtilsService: PlatformUtilsService, private userService: UserService, private policyListService: PolicyListService, private router: Router, private environmentService: EnvironmentService) { } @@ -106,30 +104,18 @@ export class PoliciesComponent implements OnInit { this.loading = false; } - edit(policy: BasePolicy) { - if (this.modal != null) { - this.modal.close(); - } - - const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent); - this.modal = this.editModalRef.createComponent(factory).instance; - const childComponent = this.modal.show( - PolicyEditComponent, this.editModalRef); - - childComponent.policy = policy; - childComponent.organizationId = this.organizationId; - childComponent.policiesEnabledMap = this.policiesEnabledMap; - childComponent.onSavedPolicy.subscribe(() => { - this.modal.close(); - this.load(); - }); - - this.modal.onClosed.subscribe(() => { - this.modal = null; + async edit(policy: BasePolicy) { + const [modal] = await this.modalService.openViewRef(PolicyEditComponent, this.editModalRef, comp => { + comp.policy = policy; + comp.organizationId = this.organizationId; + comp.policiesEnabledMap = this.policiesEnabledMap; + comp.onSavedPolicy.subscribe(() => { + modal.close(); + this.load(); + }); }); } - // Remove when removing deprecation warning async goToEnterprisePortal() { if (this.enterpriseTokenPromise != null) { diff --git a/src/app/organizations/settings/account.component.ts b/src/app/organizations/settings/account.component.ts index e3a57b39..4cb9a5c3 100644 --- a/src/app/organizations/settings/account.component.ts +++ b/src/app/organizations/settings/account.component.ts @@ -1,6 +1,5 @@ import { Component, - ComponentFactoryResolver, ViewChild, ViewContainerRef, } from '@angular/core'; @@ -8,6 +7,7 @@ import { import { ActivatedRoute } from '@angular/router'; import { ToasterService } from 'angular2-toaster'; +import { ModalService } from 'jslib-angular/services/modal.service'; import { ApiService } from 'jslib-common/abstractions/api.service'; import { CryptoService } from 'jslib-common/abstractions/crypto.service'; @@ -20,8 +20,6 @@ import { OrganizationUpdateRequest } from 'jslib-common/models/request/organizat import { OrganizationResponse } from 'jslib-common/models/response/organizationResponse'; -import { ModalComponent } from '../../modal.component'; - import { ApiKeyComponent } from '../../settings/api-key.component'; import { PurgeVaultComponent } from '../../settings/purge-vault.component'; import { TaxInfoComponent } from '../../settings/tax-info.component'; @@ -47,9 +45,8 @@ export class AccountComponent { taxFormPromise: Promise; private organizationId: string; - private modal: ModalComponent = null; - constructor(private componentFactoryResolver: ComponentFactoryResolver, + constructor(private modalService: ModalService, private apiService: ApiService, private i18nService: I18nService, private toasterService: ToasterService, private route: ActivatedRoute, private syncService: SyncService, private platformUtilsService: PlatformUtilsService, @@ -96,79 +93,42 @@ export class AccountComponent { this.toasterService.popAsync('success', null, this.i18nService.t('taxInfoUpdated')); } - deleteOrganization() { - if (this.modal != null) { - this.modal.close(); - } - - const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent); - this.modal = this.deleteModalRef.createComponent(factory).instance; - const childComponent = this.modal.show( - DeleteOrganizationComponent, this.deleteModalRef); - childComponent.organizationId = this.organizationId; - - this.modal.onClosed.subscribe(async () => { - this.modal = null; + async deleteOrganization() { + await this.modalService.openViewRef(DeleteOrganizationComponent, this.deleteModalRef, comp => { + comp.organizationId = this.organizationId; }); } - purgeVault() { - if (this.modal != null) { - this.modal.close(); - } - - const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent); - this.modal = this.purgeModalRef.createComponent(factory).instance; - const childComponent = this.modal.show(PurgeVaultComponent, this.purgeModalRef); - childComponent.organizationId = this.organizationId; - - this.modal.onClosed.subscribe(async () => { - this.modal = null; + async purgeVault() { + await this.modalService.openViewRef(PurgeVaultComponent, this.purgeModalRef, comp => { + comp.organizationId = this.organizationId; }); } - viewApiKey() { - if (this.modal != null) { - this.modal.close(); - } - - const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent); - this.modal = this.apiKeyModalRef.createComponent(factory).instance; - const childComponent = this.modal.show(ApiKeyComponent, this.apiKeyModalRef); - childComponent.keyType = 'organization'; - childComponent.entityId = this.organizationId; - childComponent.postKey = this.apiService.postOrganizationApiKey.bind(this.apiService); - childComponent.scope = 'api.organization'; - childComponent.grantType = 'client_credentials'; - childComponent.apiKeyTitle = 'apiKey'; - childComponent.apiKeyWarning = 'apiKeyWarning'; - childComponent.apiKeyDescription = 'apiKeyDesc'; - - this.modal.onClosed.subscribe(async () => { - this.modal = null; + async viewApiKey() { + await this.modalService.openViewRef(ApiKeyComponent, this.apiKeyModalRef, comp => { + comp.keyType = 'organization'; + comp.entityId = this.organizationId; + comp.postKey = this.apiService.postOrganizationApiKey.bind(this.apiService); + comp.scope = 'api.organization'; + comp.grantType = 'client_credentials'; + comp.apiKeyTitle = 'apiKey'; + comp.apiKeyWarning = 'apiKeyWarning'; + comp.apiKeyDescription = 'apiKeyDesc'; }); } - rotateApiKey() { - if (this.modal != null) { - this.modal.close(); - } - - const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent); - this.modal = this.rotateApiKeyModalRef.createComponent(factory).instance; - const childComponent = this.modal.show(ApiKeyComponent, this.rotateApiKeyModalRef); - childComponent.keyType = 'organization'; - childComponent.isRotation = true; - childComponent.entityId = this.organizationId; - childComponent.postKey = this.apiService.postOrganizationRotateApiKey.bind(this.apiService); - childComponent.scope = 'api.organization'; - childComponent.grantType = 'client_credentials'; - childComponent.apiKeyTitle = 'apiKey'; - childComponent.apiKeyWarning = 'apiKeyWarning'; - childComponent.apiKeyDescription = 'apiKeyRotateDesc'; - - this.modal.onClosed.subscribe(async () => { - this.modal = null; + async rotateApiKey() { + await this.modalService.openViewRef(ApiKeyComponent, this.rotateApiKeyModalRef, comp => { + comp.keyType = 'organization'; + comp.isRotation = true; + comp.entityId = this.organizationId; + comp.postKey = this.apiService.postOrganizationRotateApiKey.bind(this.apiService); + comp.scope = 'api.organization'; + comp.grantType = 'client_credentials'; + comp.apiKeyTitle = 'apiKey'; + comp.apiKeyWarning = 'apiKeyWarning'; + comp.apiKeyDescription = 'apiKeyRotateDesc'; }); } } diff --git a/src/app/organizations/settings/two-factor-setup.component.ts b/src/app/organizations/settings/two-factor-setup.component.ts index 5fa77957..d2969266 100644 --- a/src/app/organizations/settings/two-factor-setup.component.ts +++ b/src/app/organizations/settings/two-factor-setup.component.ts @@ -1,7 +1,4 @@ -import { - Component, - ComponentFactoryResolver, -} from '@angular/core'; +import { Component } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { ApiService } from 'jslib-common/abstractions/api.service'; @@ -9,6 +6,8 @@ import { MessagingService } from 'jslib-common/abstractions/messaging.service'; import { PolicyService } from 'jslib-common/abstractions/policy.service'; import { UserService } from 'jslib-common/abstractions/user.service'; +import { ModalService } from 'jslib-angular/services/modal.service'; + import { TwoFactorProviderType } from 'jslib-common/enums/twoFactorProviderType'; import { TwoFactorDuoComponent } from '../../settings/two-factor-duo.component'; @@ -20,9 +19,9 @@ import { TwoFactorSetupComponent as BaseTwoFactorSetupComponent } from '../../se }) export class TwoFactorSetupComponent extends BaseTwoFactorSetupComponent { constructor(apiService: ApiService, userService: UserService, - componentFactoryResolver: ComponentFactoryResolver, messagingService: MessagingService, + modalService: ModalService, messagingService: MessagingService, policyService: PolicyService, private route: ActivatedRoute) { - super(apiService, userService, componentFactoryResolver, messagingService, policyService); + super(apiService, userService, modalService, messagingService, policyService); } async ngOnInit() { @@ -32,10 +31,10 @@ export class TwoFactorSetupComponent extends BaseTwoFactorSetupComponent { }); } - manage(type: TwoFactorProviderType) { + async manage(type: TwoFactorProviderType) { switch (type) { case TwoFactorProviderType.OrganizationDuo: - const duoComp = this.openModal(this.duoModalRef, TwoFactorDuoComponent); + const duoComp = await this.openModal(this.duoModalRef, TwoFactorDuoComponent); duoComp.type = TwoFactorProviderType.OrganizationDuo; duoComp.organizationId = this.organizationId; duoComp.onUpdated.subscribe((enabled: boolean) => { diff --git a/src/app/organizations/tools/exposed-passwords-report.component.ts b/src/app/organizations/tools/exposed-passwords-report.component.ts index 5e298684..2eac7259 100644 --- a/src/app/organizations/tools/exposed-passwords-report.component.ts +++ b/src/app/organizations/tools/exposed-passwords-report.component.ts @@ -1,7 +1,4 @@ -import { - Component, - ComponentFactoryResolver, -} from '@angular/core'; +import { Component } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { AuditService } from 'jslib-common/abstractions/audit.service'; @@ -9,6 +6,8 @@ import { CipherService } from 'jslib-common/abstractions/cipher.service'; import { MessagingService } from 'jslib-common/abstractions/messaging.service'; import { UserService } from 'jslib-common/abstractions/user.service'; +import { ModalService } from 'jslib-angular/services/modal.service'; + import { ExposedPasswordsReportComponent as BaseExposedPasswordsReportComponent, } from '../../tools/exposed-passwords-report.component'; @@ -24,9 +23,9 @@ export class ExposedPasswordsReportComponent extends BaseExposedPasswordsReportC manageableCiphers: Cipher[]; constructor(cipherService: CipherService, auditService: AuditService, - componentFactoryResolver: ComponentFactoryResolver, messagingService: MessagingService, + modalService: ModalService, messagingService: MessagingService, userService: UserService, private route: ActivatedRoute) { - super(cipherService, auditService, componentFactoryResolver, messagingService, userService); + super(cipherService, auditService, modalService, messagingService, userService); } ngOnInit() { diff --git a/src/app/organizations/tools/inactive-two-factor-report.component.ts b/src/app/organizations/tools/inactive-two-factor-report.component.ts index e20721cd..10402887 100644 --- a/src/app/organizations/tools/inactive-two-factor-report.component.ts +++ b/src/app/organizations/tools/inactive-two-factor-report.component.ts @@ -1,13 +1,12 @@ -import { - Component, - ComponentFactoryResolver, -} from '@angular/core'; +import { Component } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { CipherService } from 'jslib-common/abstractions/cipher.service'; import { MessagingService } from 'jslib-common/abstractions/messaging.service'; import { UserService } from 'jslib-common/abstractions/user.service'; +import { ModalService } from 'jslib-angular/services/modal.service'; + import { InactiveTwoFactorReportComponent as BaseInactiveTwoFactorReportComponent, } from '../../tools/inactive-two-factor-report.component'; @@ -19,10 +18,10 @@ import { CipherView } from 'jslib-common/models/view/cipherView'; templateUrl: '../../tools/inactive-two-factor-report.component.html', }) export class InactiveTwoFactorReportComponent extends BaseInactiveTwoFactorReportComponent { - constructor(cipherService: CipherService, componentFactoryResolver: ComponentFactoryResolver, + constructor(cipherService: CipherService, modalService: ModalService, messagingService: MessagingService, userService: UserService, private route: ActivatedRoute) { - super(cipherService, componentFactoryResolver, messagingService, userService); + super(cipherService, modalService, messagingService, userService); } async ngOnInit() { diff --git a/src/app/organizations/tools/reused-passwords-report.component.ts b/src/app/organizations/tools/reused-passwords-report.component.ts index f116c538..14de3270 100644 --- a/src/app/organizations/tools/reused-passwords-report.component.ts +++ b/src/app/organizations/tools/reused-passwords-report.component.ts @@ -1,13 +1,12 @@ -import { - Component, - ComponentFactoryResolver, -} from '@angular/core'; +import { Component } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { CipherService } from 'jslib-common/abstractions/cipher.service'; import { MessagingService } from 'jslib-common/abstractions/messaging.service'; import { UserService } from 'jslib-common/abstractions/user.service'; +import { ModalService } from 'jslib-angular/services/modal.service'; + import { Cipher } from 'jslib-common/models/domain/cipher'; import { CipherView } from 'jslib-common/models/view/cipherView'; @@ -23,10 +22,10 @@ import { export class ReusedPasswordsReportComponent extends BaseReusedPasswordsReportComponent { manageableCiphers: Cipher[]; - constructor(cipherService: CipherService, componentFactoryResolver: ComponentFactoryResolver, + constructor(cipherService: CipherService, modalService: ModalService, messagingService: MessagingService, userService: UserService, private route: ActivatedRoute) { - super(cipherService, componentFactoryResolver, messagingService, userService); + super(cipherService, modalService, messagingService, userService); } async ngOnInit() { diff --git a/src/app/organizations/tools/unsecured-websites-report.component.ts b/src/app/organizations/tools/unsecured-websites-report.component.ts index 5c439a54..01123f20 100644 --- a/src/app/organizations/tools/unsecured-websites-report.component.ts +++ b/src/app/organizations/tools/unsecured-websites-report.component.ts @@ -1,13 +1,12 @@ -import { - Component, - ComponentFactoryResolver, -} from '@angular/core'; +import { Component } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { CipherService } from 'jslib-common/abstractions/cipher.service'; import { MessagingService } from 'jslib-common/abstractions/messaging.service'; import { UserService } from 'jslib-common/abstractions/user.service'; +import { ModalService } from 'jslib-angular/services/modal.service'; + import { UnsecuredWebsitesReportComponent as BaseUnsecuredWebsitesReportComponent, } from '../../tools/unsecured-websites-report.component'; @@ -19,10 +18,10 @@ import { CipherView } from 'jslib-common/models/view/cipherView'; templateUrl: '../../tools/unsecured-websites-report.component.html', }) export class UnsecuredWebsitesReportComponent extends BaseUnsecuredWebsitesReportComponent { - constructor(cipherService: CipherService, componentFactoryResolver: ComponentFactoryResolver, + constructor(cipherService: CipherService, modalService: ModalService, messagingService: MessagingService, userService: UserService, private route: ActivatedRoute) { - super(cipherService, componentFactoryResolver, messagingService, userService); + super(cipherService, modalService, messagingService, userService); } async ngOnInit() { diff --git a/src/app/organizations/tools/weak-passwords-report.component.ts b/src/app/organizations/tools/weak-passwords-report.component.ts index 08c43dad..5150a4cd 100644 --- a/src/app/organizations/tools/weak-passwords-report.component.ts +++ b/src/app/organizations/tools/weak-passwords-report.component.ts @@ -1,7 +1,4 @@ -import { - Component, - ComponentFactoryResolver, -} from '@angular/core'; +import { Component } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { CipherService } from 'jslib-common/abstractions/cipher.service'; @@ -9,6 +6,8 @@ import { MessagingService } from 'jslib-common/abstractions/messaging.service'; import { PasswordGenerationService } from 'jslib-common/abstractions/passwordGeneration.service'; import { UserService } from 'jslib-common/abstractions/user.service'; +import { ModalService } from 'jslib-angular/services/modal.service'; + import { Cipher } from 'jslib-common/models/domain/cipher'; import { CipherView } from 'jslib-common/models/view/cipherView'; @@ -25,9 +24,9 @@ export class WeakPasswordsReportComponent extends BaseWeakPasswordsReportCompone manageableCiphers: Cipher[]; constructor(cipherService: CipherService, passwordGenerationService: PasswordGenerationService, - componentFactoryResolver: ComponentFactoryResolver, messagingService: MessagingService, + modalService: ModalService, messagingService: MessagingService, userService: UserService, private route: ActivatedRoute) { - super(cipherService, passwordGenerationService, componentFactoryResolver, messagingService, userService); + super(cipherService, passwordGenerationService, modalService, messagingService, userService); } async ngOnInit() { diff --git a/src/app/organizations/vault/vault.component.html b/src/app/organizations/vault/vault.component.html index 23b396cd..b70ad1d4 100644 --- a/src/app/organizations/vault/vault.component.html +++ b/src/app/organizations/vault/vault.component.html @@ -20,7 +20,7 @@
-