mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 15:53:27 +00:00
routing updates
This commit is contained in:
@@ -40,7 +40,7 @@ export class ViewComponent implements OnChanges, OnDestroy {
|
||||
}
|
||||
|
||||
async ngOnChanges() {
|
||||
this.showPassword = false;
|
||||
this.cleanUp();
|
||||
|
||||
const cipher = await this.cipherService.get(this.cipherId);
|
||||
this.cipher = await cipher.decrypt();
|
||||
@@ -52,10 +52,6 @@ export class ViewComponent implements OnChanges, OnDestroy {
|
||||
await this.totpUpdateCode();
|
||||
await this.totpTick();
|
||||
|
||||
if (this.totpInterval) {
|
||||
clearInterval(this.totpInterval);
|
||||
}
|
||||
|
||||
this.totpInterval = setInterval(async () => {
|
||||
await this.totpTick();
|
||||
}, 1000);
|
||||
@@ -63,9 +59,7 @@ export class ViewComponent implements OnChanges, OnDestroy {
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
if (this.totpInterval) {
|
||||
clearInterval(this.totpInterval);
|
||||
}
|
||||
this.cleanUp();
|
||||
}
|
||||
|
||||
edit() {
|
||||
@@ -84,6 +78,14 @@ export class ViewComponent implements OnChanges, OnDestroy {
|
||||
// TODO
|
||||
}
|
||||
|
||||
private cleanUp() {
|
||||
this.cipher = null;
|
||||
this.showPassword = false;
|
||||
if (this.totpInterval) {
|
||||
clearInterval(this.totpInterval);
|
||||
}
|
||||
}
|
||||
|
||||
private async totpUpdateCode() {
|
||||
if (this.cipher.type !== CipherType.Login || this.cipher.login.totp == null) {
|
||||
return;
|
||||
@@ -111,5 +113,4 @@ export class ViewComponent implements OnChanges, OnDestroy {
|
||||
await this.totpUpdateCode();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user