1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-14 15:23:33 +00:00

password history and updated dates on view

This commit is contained in:
Kyle Spearrin
2018-07-30 10:05:36 -04:00
parent 2ecbd4564c
commit a7318e0937
8 changed files with 115 additions and 3 deletions

2
jslib

Submodule jslib updated: 9df96a3288...c0f6fa2db1

View File

@@ -47,6 +47,7 @@ import { FolderAddEditComponent } from './vault/folder-add-edit.component';
import { GroupingsComponent } from './vault/groupings.component'; import { GroupingsComponent } from './vault/groupings.component';
import { PasswordGeneratorHistoryComponent } from './vault/password-generator-history.component'; import { PasswordGeneratorHistoryComponent } from './vault/password-generator-history.component';
import { PasswordGeneratorComponent } from './vault/password-generator.component'; import { PasswordGeneratorComponent } from './vault/password-generator.component';
import { PasswordHistoryComponent } from './vault/password-history.component';
import { VaultComponent } from './vault/vault.component'; import { VaultComponent } from './vault/vault.component';
import { ViewComponent } from './vault/view.component'; import { ViewComponent } from './vault/view.component';
@@ -85,6 +86,7 @@ import { ViewComponent } from './vault/view.component';
ModalComponent, ModalComponent,
PasswordGeneratorComponent, PasswordGeneratorComponent,
PasswordGeneratorHistoryComponent, PasswordGeneratorHistoryComponent,
PasswordHistoryComponent,
PremiumComponent, PremiumComponent,
RegisterComponent, RegisterComponent,
SearchCiphersPipe, SearchCiphersPipe,
@@ -104,6 +106,7 @@ import { ViewComponent } from './vault/view.component';
ModalComponent, ModalComponent,
PasswordGeneratorComponent, PasswordGeneratorComponent,
PasswordGeneratorHistoryComponent, PasswordGeneratorHistoryComponent,
PasswordHistoryComponent,
PremiumComponent, PremiumComponent,
SettingsComponent, SettingsComponent,
TwoFactorOptionsComponent, TwoFactorOptionsComponent,

View File

@@ -0,0 +1,35 @@
<div class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<div class="box">
<div class="box-header">
{{'passwordHistory' | i18n}}
</div>
<div class="box-content condensed">
<div class="box-content-row box-content-row-flex" *ngFor="let h of history">
<div class="row-main">
<span class="text monospaced">
{{h.password}}
</span>
<span class="detail">{{h.lastUsedDate | date:'medium'}}</span>
</div>
<div class="action-buttons">
<a class="row-btn" href="#" appStopClick title="{{'copyPassword' | i18n}}"
(click)="copy(h.password)">
<i class="fa fa-lg fa-clipboard"></i>
</a>
</div>
</div>
<div class="box-content-row" *ngIf="!history.length">
{{'noPasswordsInList' | i18n}}
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" data-dismiss="modal">{{'close' | i18n}}</button>
</div>
</div>
</div>
</div>

View File

@@ -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);
}
}

View File

@@ -18,7 +18,8 @@
<app-vault-view id="details" <app-vault-view id="details"
*ngIf="cipherId && action === 'view'" *ngIf="cipherId && action === 'view'"
[cipherId]="cipherId" [cipherId]="cipherId"
(onEditCipher)="editCipher($event)"> (onEditCipher)="editCipher($event)"
(onViewCipherPasswordHistory)="viewCipherPasswordHistory($event)">
</app-vault-view> </app-vault-view>
<app-vault-add-edit id="details" <app-vault-add-edit id="details"
*ngIf="action === 'add' || action === 'edit'" *ngIf="action === 'add' || action === 'edit'"
@@ -41,4 +42,5 @@
<ng-template #passwordGenerator></ng-template> <ng-template #passwordGenerator></ng-template>
<ng-template #attachments></ng-template> <ng-template #attachments></ng-template>
<ng-template #folderAddEdit></ng-template> <ng-template #folderAddEdit></ng-template>
<ng-template #passwordHistory></ng-template>
</div> </div>

View File

@@ -29,11 +29,11 @@ import { CiphersComponent } from './ciphers.component';
import { FolderAddEditComponent } from './folder-add-edit.component'; import { FolderAddEditComponent } from './folder-add-edit.component';
import { GroupingsComponent } from './groupings.component'; import { GroupingsComponent } from './groupings.component';
import { PasswordGeneratorComponent } from './password-generator.component'; import { PasswordGeneratorComponent } from './password-generator.component';
import { PasswordHistoryComponent } from './password-history.component';
import { CipherType } from 'jslib/enums/cipherType'; import { CipherType } from 'jslib/enums/cipherType';
import { CipherView } from 'jslib/models/view/cipherView'; import { CipherView } from 'jslib/models/view/cipherView';
import { CollectionView } from 'jslib/models/view/collectionView';
import { FolderView } from 'jslib/models/view/folderView'; import { FolderView } from 'jslib/models/view/folderView';
import { I18nService } from 'jslib/abstractions/i18n.service'; import { I18nService } from 'jslib/abstractions/i18n.service';
@@ -55,6 +55,7 @@ export class VaultComponent implements OnInit, OnDestroy {
@ViewChild('passwordGenerator', { read: ViewContainerRef }) passwordGeneratorModalRef: ViewContainerRef; @ViewChild('passwordGenerator', { read: ViewContainerRef }) passwordGeneratorModalRef: ViewContainerRef;
@ViewChild('attachments', { read: ViewContainerRef }) attachmentsModalRef: ViewContainerRef; @ViewChild('attachments', { read: ViewContainerRef }) attachmentsModalRef: ViewContainerRef;
@ViewChild('folderAddEdit', { read: ViewContainerRef }) folderAddEditModalRef: ViewContainerRef; @ViewChild('folderAddEdit', { read: ViewContainerRef }) folderAddEditModalRef: ViewContainerRef;
@ViewChild('passwordHistory', { read: ViewContainerRef }) passwordHistoryModalRef: ViewContainerRef;
action: string; action: string;
cipherId: string = null; 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>(PasswordHistoryComponent,
this.passwordHistoryModalRef);
childComponent.cipherId = cipher.id;
this.modal.onClosed.subscribe(async () => {
this.modal = null;
});
}
cancelledAddEdit(cipher: CipherView) { cancelledAddEdit(cipher: CipherView) {
this.cipherId = cipher.id; this.cipherId = cipher.id;
this.action = this.cipherId != null ? 'view' : null; this.action = this.cipherId != null ? 'view' : null;

View File

@@ -245,6 +245,29 @@
</a> </a>
</div> </div>
</div> </div>
<div class="box">
<div class="box-header">
{{'other' | i18n}}
</div>
<div class="box-content">
<div class="box-content-row">
<span class="row-label">{{'dateUpdated' | i18n}}</span>
{{cipher.revisionDate | date:'medium'}}
</div>
<div class="box-content-row box-content-row-flex" *ngIf="cipher.passwordRevisionDisplayDate">
<div class="row-main">
<span class="row-label">{{'datePasswordUpdated' | i18n}}</span>
{{cipher.passwordRevisionDisplayDate | date:'medium'}}
</div>
<div class="action-buttons" *ngIf="cipher.hasPasswordHistory">
<a class="row-btn" href="#" appStopClick title="{{'passwordHistory' | i18n}}"
(click)="viewHistory(c)">
<i class="fa fa-lg fa-clock-o"></i>
</a>
</div>
</div>
</div>
</div>
</div> </div>
</div> </div>
<div class="footer"> <div class="footer">

View File

@@ -1067,5 +1067,13 @@
}, },
"hideToTray": { "hideToTray": {
"message": "Hide to Tray" "message": "Hide to Tray"
},
"dateUpdated": {
"message": "Updated",
"description": "ex. Date this item was updated"
},
"datePasswordUpdated": {
"message": "Password Updated",
"description": "ex. Date this password was updated"
} }
} }