diff --git a/src/app/vault/add.component.ts b/src/app/vault/add.component.ts index 89bc7ad285..5ac1c0a1ae 100644 --- a/src/app/vault/add.component.ts +++ b/src/app/vault/add.component.ts @@ -6,9 +6,16 @@ import { OnChanges, } from '@angular/core'; +import { CipherType } from 'jslib/enums/cipherType'; +import { SecureNoteType } from 'jslib/enums/secureNoteType'; + import { CipherService } from 'jslib/abstractions/cipher.service'; +import { CardView } from 'jslib/models/view/cardView'; import { CipherView } from 'jslib/models/view/cipherView'; +import { IdentityView } from 'jslib/models/view/identityView'; +import { LoginView } from 'jslib/models/view/loginView'; +import { SecureNoteView } from 'jslib/models/view/secureNoteView'; @Component({ selector: 'app-vault-add', @@ -23,5 +30,12 @@ export class AddComponent implements OnChanges { async ngOnChanges() { this.cipher = new CipherView(); + this.cipher.folderId = null; // TODO + this.cipher.type = CipherType.Login; + this.cipher.login = new LoginView(); + this.cipher.card = new CardView(); + this.cipher.identity = new IdentityView(); + this.cipher.secureNote = new SecureNoteView(); + this.cipher.secureNote.type = SecureNoteType.Generic; } } diff --git a/src/app/vault/view.component.ts b/src/app/vault/view.component.ts index 3a681b2ef3..096db7a26d 100644 --- a/src/app/vault/view.component.ts +++ b/src/app/vault/view.component.ts @@ -57,7 +57,7 @@ export class ViewComponent implements OnChanges, OnDestroy { this.isPremium = this.tokenService.getPremium(); - if (this.cipher.type == CipherType.Login && this.cipher.login.totp && + if (this.cipher.type === CipherType.Login && this.cipher.login.totp && (cipher.organizationUseTotp || this.isPremium)) { await this.totpUpdateCode(); await this.totpTick();