From a7318e0937a34d1322f928fb1a15b21a036c8857 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 30 Jul 2018 10:05:36 -0400 Subject: [PATCH] password history and updated dates on view --- jslib | 2 +- src/app/app.module.ts | 3 ++ src/app/vault/password-history.component.html | 35 +++++++++++++++++++ src/app/vault/password-history.component.ts | 24 +++++++++++++ src/app/vault/vault.component.html | 4 ++- src/app/vault/vault.component.ts | 19 +++++++++- src/app/vault/view.component.html | 23 ++++++++++++ src/locales/en/messages.json | 8 +++++ 8 files changed, 115 insertions(+), 3 deletions(-) create mode 100644 src/app/vault/password-history.component.html create mode 100644 src/app/vault/password-history.component.ts diff --git a/jslib b/jslib index 9df96a32885..c0f6fa2db16 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit 9df96a3288510a5b92837d93513d9981336d0229 +Subproject commit c0f6fa2db165d0c33752c10d6649323a9b4268b4 diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 8080a533fee..2563272e55e 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -47,6 +47,7 @@ import { FolderAddEditComponent } from './vault/folder-add-edit.component'; import { GroupingsComponent } from './vault/groupings.component'; import { PasswordGeneratorHistoryComponent } from './vault/password-generator-history.component'; import { PasswordGeneratorComponent } from './vault/password-generator.component'; +import { PasswordHistoryComponent } from './vault/password-history.component'; import { VaultComponent } from './vault/vault.component'; import { ViewComponent } from './vault/view.component'; @@ -85,6 +86,7 @@ import { ViewComponent } from './vault/view.component'; ModalComponent, PasswordGeneratorComponent, PasswordGeneratorHistoryComponent, + PasswordHistoryComponent, PremiumComponent, RegisterComponent, SearchCiphersPipe, @@ -104,6 +106,7 @@ import { ViewComponent } from './vault/view.component'; ModalComponent, PasswordGeneratorComponent, PasswordGeneratorHistoryComponent, + PasswordHistoryComponent, PremiumComponent, SettingsComponent, TwoFactorOptionsComponent, diff --git a/src/app/vault/password-history.component.html b/src/app/vault/password-history.component.html new file mode 100644 index 00000000000..627f49442de --- /dev/null +++ b/src/app/vault/password-history.component.html @@ -0,0 +1,35 @@ + diff --git a/src/app/vault/password-history.component.ts b/src/app/vault/password-history.component.ts new file mode 100644 index 00000000000..dd1247c3b8a --- /dev/null +++ b/src/app/vault/password-history.component.ts @@ -0,0 +1,24 @@ +import { ToasterService } from 'angular2-toaster'; +import { Angulartics2 } from 'angulartics2'; + +import { Component } from '@angular/core'; + +import { CipherService } from 'jslib/abstractions/cipher.service'; +import { I18nService } from 'jslib/abstractions/i18n.service'; +import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; + +import { + PasswordHistoryComponent as BasePasswordHistoryComponent, +} from 'jslib/angular/components/password-history.component'; + +@Component({ + selector: 'app-password-history', + templateUrl: 'password-history.component.html', +}) +export class PasswordHistoryComponent extends BasePasswordHistoryComponent { + constructor(cipherService: CipherService, analytics: Angulartics2, + platformUtilsService: PlatformUtilsService, i18nService: I18nService, + toasterService: ToasterService) { + super(cipherService, analytics, platformUtilsService, i18nService, toasterService, window); + } +} diff --git a/src/app/vault/vault.component.html b/src/app/vault/vault.component.html index 7be4a1959bb..add0f511908 100644 --- a/src/app/vault/vault.component.html +++ b/src/app/vault/vault.component.html @@ -18,7 +18,8 @@ + (onEditCipher)="editCipher($event)" + (onViewCipherPasswordHistory)="viewCipherPasswordHistory($event)"> + diff --git a/src/app/vault/vault.component.ts b/src/app/vault/vault.component.ts index e491bdc9034..55bbe5dd703 100644 --- a/src/app/vault/vault.component.ts +++ b/src/app/vault/vault.component.ts @@ -29,11 +29,11 @@ import { CiphersComponent } from './ciphers.component'; import { FolderAddEditComponent } from './folder-add-edit.component'; import { GroupingsComponent } from './groupings.component'; import { PasswordGeneratorComponent } from './password-generator.component'; +import { PasswordHistoryComponent } from './password-history.component'; import { CipherType } from 'jslib/enums/cipherType'; import { CipherView } from 'jslib/models/view/cipherView'; -import { CollectionView } from 'jslib/models/view/collectionView'; import { FolderView } from 'jslib/models/view/folderView'; import { I18nService } from 'jslib/abstractions/i18n.service'; @@ -55,6 +55,7 @@ export class VaultComponent implements OnInit, OnDestroy { @ViewChild('passwordGenerator', { read: ViewContainerRef }) passwordGeneratorModalRef: ViewContainerRef; @ViewChild('attachments', { read: ViewContainerRef }) attachmentsModalRef: ViewContainerRef; @ViewChild('folderAddEdit', { read: ViewContainerRef }) folderAddEditModalRef: ViewContainerRef; + @ViewChild('passwordHistory', { read: ViewContainerRef }) passwordHistoryModalRef: ViewContainerRef; action: string; cipherId: string = null; @@ -347,6 +348,22 @@ export class VaultComponent implements OnInit, OnDestroy { }); } + viewCipherPasswordHistory(cipher: CipherView) { + if (this.modal != null) { + this.modal.close(); + } + + const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent); + this.modal = this.passwordHistoryModalRef.createComponent(factory).instance; + const childComponent = this.modal.show(PasswordHistoryComponent, + this.passwordHistoryModalRef); + + childComponent.cipherId = cipher.id; + this.modal.onClosed.subscribe(async () => { + this.modal = null; + }); + } + cancelledAddEdit(cipher: CipherView) { this.cipherId = cipher.id; this.action = this.cipherId != null ? 'view' : null; diff --git a/src/app/vault/view.component.html b/src/app/vault/view.component.html index 05c36148431..3b503dafb99 100644 --- a/src/app/vault/view.component.html +++ b/src/app/vault/view.component.html @@ -245,6 +245,29 @@ +
+
+ {{'other' | i18n}} +
+
+
+ {{'dateUpdated' | i18n}} + {{cipher.revisionDate | date:'medium'}} +
+
+
+ {{'datePasswordUpdated' | i18n}} + {{cipher.passwordRevisionDisplayDate | date:'medium'}} +
+
+ + + +
+
+
+