dont init history

This commit is contained in:
Kyle Spearrin 2018-02-17 22:51:28 -05:00
parent acb7b7b8e3
commit 80cd30d7d8
1 changed files with 3 additions and 3 deletions

View File

@ -148,7 +148,7 @@ export class PasswordGenerationService implements PasswordGenerationServiceAbstr
} }
private optionsCache: any; private optionsCache: any;
private history: PasswordHistory[] = []; private history: PasswordHistory[];
constructor(private cryptoService: CryptoService, private storageService: StorageService) { constructor(private cryptoService: CryptoService, private storageService: StorageService) {
} }
@ -203,11 +203,11 @@ export class PasswordGenerationService implements PasswordGenerationServiceAbstr
return; return;
} }
currentHistory.push(new PasswordHistory(password, Date.now())); currentHistory.unshift(new PasswordHistory(password, Date.now()));
// Remove old items. // Remove old items.
if (currentHistory.length > MaxPasswordsInHistory) { if (currentHistory.length > MaxPasswordsInHistory) {
currentHistory.shift(); currentHistory.pop();
} }
const newHistory = await this.encryptHistory(currentHistory); const newHistory = await this.encryptHistory(currentHistory);