diff --git a/src/app/modal.component.ts b/src/app/modal.component.ts index 7e00c63be9..1435562c6c 100644 --- a/src/app/modal.component.ts +++ b/src/app/modal.component.ts @@ -4,7 +4,6 @@ import { Component, ComponentFactoryResolver, EventEmitter, - Input, OnDestroy, Output, Type, @@ -17,6 +16,10 @@ import { template: ``, }) export class ModalComponent implements OnDestroy { + @Output() onClose = new EventEmitter(); + @Output() onClosed = new EventEmitter(); + @Output() onShow = new EventEmitter(); + @Output() onShown = new EventEmitter(); @ViewChild('container', { read: ViewContainerRef }) container: ViewContainerRef; parentContainer: ViewContainerRef = null; fade: boolean = true; @@ -29,6 +32,7 @@ export class ModalComponent implements OnDestroy { } show(type: Type, parentContainer: ViewContainerRef, fade: boolean = true): T { + this.onShow.emit(); this.parentContainer = parentContainer; this.fade = fade; @@ -50,10 +54,13 @@ export class ModalComponent implements OnDestroy { }); } + this.onShown.emit(); return componentRef.instance; } close() { + this.onClose.emit(); + this.onClosed.emit(); if (this.parentContainer != null) { this.parentContainer.clear(); } diff --git a/src/app/vault/add-edit.component.ts b/src/app/vault/add-edit.component.ts index 452b9aba0b..add71960b2 100644 --- a/src/app/vault/add-edit.component.ts +++ b/src/app/vault/add-edit.component.ts @@ -175,6 +175,11 @@ export class AddEditComponent implements OnChanges { } generatePassword() { + if (this.cipher.login != null && this.cipher.login.password != null && this.cipher.login.password.length && + !confirm(this.i18nService.t('overwritePasswordConfirmation'))) { + return; + } + this.onGeneratePassword.emit(); } } diff --git a/src/app/vault/password-generator.component.html b/src/app/vault/password-generator.component.html index 7f15cda9ad..d02bc40701 100644 --- a/src/app/vault/password-generator.component.html +++ b/src/app/vault/password-generator.component.html @@ -68,7 +68,7 @@