mirror of
https://github.com/bitwarden/browser
synced 2025-12-21 10:43:35 +00:00
password history
This commit is contained in:
38
src/app/vault/password-generator-history.component.ts
Normal file
38
src/app/vault/password-generator-history.component.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import * as template from './password-generator-history.component.html';
|
||||
|
||||
import { Angulartics2 } from 'angulartics2';
|
||||
|
||||
import {
|
||||
Component,
|
||||
OnInit,
|
||||
} from '@angular/core';
|
||||
|
||||
import { PasswordGenerationService } from 'jslib/abstractions/passwordGeneration.service';
|
||||
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
|
||||
|
||||
import { PasswordHistory } from 'jslib/models/domain/passwordHistory';
|
||||
|
||||
@Component({
|
||||
selector: 'app-password-generator-history',
|
||||
template: template,
|
||||
})
|
||||
export class PasswordGeneratorHistoryComponent implements OnInit {
|
||||
history: PasswordHistory[];
|
||||
|
||||
constructor(private passwordGenerationService: PasswordGenerationService, private analytics: Angulartics2,
|
||||
private platformUtilsService: PlatformUtilsService) { }
|
||||
|
||||
async ngOnInit() {
|
||||
this.history = await this.passwordGenerationService.getHistory();
|
||||
}
|
||||
|
||||
clear() {
|
||||
this.history = [];
|
||||
this.passwordGenerationService.clear();
|
||||
}
|
||||
|
||||
copy(password: string) {
|
||||
this.analytics.eventTrack.next({ action: 'Copied Historical Password' });
|
||||
this.platformUtilsService.copyToClipboard(password);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user