From 1746046f1862ec35f427fd87fc2df480fa180631 Mon Sep 17 00:00:00 2001 From: SmithThe4th Date: Thu, 6 Feb 2025 12:22:27 -0500 Subject: [PATCH] Updated cipher view to have the latest value of organizationUseTotp from server response (#13223) --- .../vault-item-dialog/vault-item-dialog.component.ts | 3 +++ .../components/custom-fields/custom-fields.component.ts | 2 +- .../components/item-details/item-details-section.component.ts | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/web/src/app/vault/components/vault-item-dialog/vault-item-dialog.component.ts b/apps/web/src/app/vault/components/vault-item-dialog/vault-item-dialog.component.ts index 0af0d720b0e..eb2289d7229 100644 --- a/apps/web/src/app/vault/components/vault-item-dialog/vault-item-dialog.component.ts +++ b/apps/web/src/app/vault/components/vault-item-dialog/vault-item-dialog.component.ts @@ -366,6 +366,9 @@ export class VaultItemDialogComponent implements OnInit, OnDestroy { const cipherData = new CipherData(cipherResponse); cipher = new Cipher(cipherData); + + // Update organizationUseTotp from server response + this.cipher.organizationUseTotp = cipher.organizationUseTotp; } // Store the updated cipher so any following edits use the most up to date cipher diff --git a/libs/vault/src/cipher-form/components/custom-fields/custom-fields.component.ts b/libs/vault/src/cipher-form/components/custom-fields/custom-fields.component.ts index 1b3b9009946..fed92c45f24 100644 --- a/libs/vault/src/cipher-form/components/custom-fields/custom-fields.component.ts +++ b/libs/vault/src/cipher-form/components/custom-fields/custom-fields.component.ts @@ -151,7 +151,7 @@ export class CustomFieldsComponent implements OnInit, AfterViewInit { const prefillCipher = this.cipherFormContainer.getInitialCipherView(); // When available, populate the form with the existing fields - prefillCipher.fields?.forEach((field) => { + prefillCipher?.fields?.forEach((field) => { let value: string | boolean = field.value; if (field.type === FieldType.Boolean) { diff --git a/libs/vault/src/cipher-form/components/item-details/item-details-section.component.ts b/libs/vault/src/cipher-form/components/item-details/item-details-section.component.ts index ca778efac4b..85cd85bbf03 100644 --- a/libs/vault/src/cipher-form/components/item-details/item-details-section.component.ts +++ b/libs/vault/src/cipher-form/components/item-details/item-details-section.component.ts @@ -158,7 +158,7 @@ export class ItemDetailsSectionComponent implements OnInit { get allowOwnershipChange() { // Do not allow ownership change in edit mode and the cipher is owned by an organization - if (this.config.mode === "edit" && this.originalCipherView.organizationId != null) { + if (this.config.mode === "edit" && this.originalCipherView?.organizationId != null) { return false; }