diff --git a/src/angular/components/add-edit.component.ts b/src/angular/components/add-edit.component.ts index 389f6d4908..87c7cd3f8c 100644 --- a/src/angular/components/add-edit.component.ts +++ b/src/angular/components/add-edit.component.ts @@ -296,6 +296,7 @@ export class AddEditComponent implements OnInit { const f = new FieldView(); f.type = this.addFieldType; + f.newField = true; this.cipher.fields.push(f); } diff --git a/src/models/data/cipherData.ts b/src/models/data/cipherData.ts index 9a45c73dae..fc87ae60d6 100644 --- a/src/models/data/cipherData.ts +++ b/src/models/data/cipherData.ts @@ -16,6 +16,7 @@ export class CipherData { folderId: string; userId: string; edit: boolean; + viewPassword: boolean; organizationUseTotp: boolean; favorite: boolean; revisionDate: string; @@ -43,6 +44,7 @@ export class CipherData { this.folderId = response.folderId; this.userId = userId; this.edit = response.edit; + this.viewPassword = response.viewPassword; this.organizationUseTotp = response.organizationUseTotp; this.favorite = response.favorite; this.revisionDate = response.revisionDate; diff --git a/src/models/domain/cipher.ts b/src/models/domain/cipher.ts index 647251f4ea..f0c37cf75c 100644 --- a/src/models/domain/cipher.ts +++ b/src/models/domain/cipher.ts @@ -24,6 +24,7 @@ export class Cipher extends Domain { favorite: boolean; organizationUseTotp: boolean; edit: boolean; + viewPassword: boolean; revisionDate: Date; localData: any; login: Login; @@ -55,6 +56,7 @@ export class Cipher extends Domain { this.favorite = obj.favorite; this.organizationUseTotp = obj.organizationUseTotp; this.edit = obj.edit; + this.viewPassword = obj.viewPassword; this.revisionDate = obj.revisionDate != null ? new Date(obj.revisionDate) : null; this.collectionIds = obj.collectionIds; this.localData = localData; @@ -169,6 +171,7 @@ export class Cipher extends Domain { c.folderId = this.folderId; c.userId = this.organizationId != null ? userId : null; c.edit = this.edit; + c.viewPassword = this.viewPassword; c.organizationUseTotp = this.organizationUseTotp; c.favorite = this.favorite; c.revisionDate = this.revisionDate != null ? this.revisionDate.toISOString() : null; diff --git a/src/models/domain/collection.ts b/src/models/domain/collection.ts index 59bbf24d07..6ed5f216f9 100644 --- a/src/models/domain/collection.ts +++ b/src/models/domain/collection.ts @@ -11,6 +11,7 @@ export class Collection extends Domain { name: CipherString; externalId: string; readOnly: boolean; + hidePasswords: boolean; constructor(obj?: CollectionData, alreadyEncrypted: boolean = false) { super(); @@ -24,7 +25,8 @@ export class Collection extends Domain { name: null, externalId: null, readOnly: null, - }, alreadyEncrypted, ['id', 'organizationId', 'externalId', 'readOnly']); + hidePasswords: null, + }, alreadyEncrypted, ['id', 'organizationId', 'externalId', 'readOnly', 'hidePasswords']); } decrypt(): Promise { diff --git a/src/models/request/selectionReadOnlyRequest.ts b/src/models/request/selectionReadOnlyRequest.ts index e947b0a364..d001edb2b0 100644 --- a/src/models/request/selectionReadOnlyRequest.ts +++ b/src/models/request/selectionReadOnlyRequest.ts @@ -1,9 +1,11 @@ export class SelectionReadOnlyRequest { id: string; readOnly: boolean; + hidePasswords: boolean; - constructor(id: string, readOnly: boolean) { + constructor(id: string, readOnly: boolean, hidePasswords: boolean) { this.id = id; this.readOnly = readOnly; + this.hidePasswords = hidePasswords; } } diff --git a/src/models/response/cipherResponse.ts b/src/models/response/cipherResponse.ts index d66e8f8447..32555a65b8 100644 --- a/src/models/response/cipherResponse.ts +++ b/src/models/response/cipherResponse.ts @@ -22,6 +22,7 @@ export class CipherResponse extends BaseResponse { secureNote: SecureNoteApi; favorite: boolean; edit: boolean; + viewPassword: boolean; organizationUseTotp: boolean; revisionDate: string; attachments: AttachmentResponse[]; @@ -39,6 +40,11 @@ export class CipherResponse extends BaseResponse { this.notes = this.getResponseProperty('Notes'); this.favorite = this.getResponseProperty('Favorite') || false; this.edit = !!this.getResponseProperty('Edit'); + if (this.getResponseProperty('ViewPassword') == null) { + this.viewPassword = true; + } else { + this.viewPassword = this.getResponseProperty('ViewPassword'); + } this.organizationUseTotp = this.getResponseProperty('OrganizationUseTotp'); this.revisionDate = this.getResponseProperty('RevisionDate'); this.collectionIds = this.getResponseProperty('CollectionIds'); diff --git a/src/models/response/selectionReadOnlyResponse.ts b/src/models/response/selectionReadOnlyResponse.ts index 5bdfc6e417..ebcf524746 100644 --- a/src/models/response/selectionReadOnlyResponse.ts +++ b/src/models/response/selectionReadOnlyResponse.ts @@ -3,10 +3,12 @@ import { BaseResponse } from './baseResponse'; export class SelectionReadOnlyResponse extends BaseResponse { id: string; readOnly: boolean; + hidePasswords: boolean; constructor(response: any) { super(response); this.id = this.getResponseProperty('Id'); this.readOnly = this.getResponseProperty('ReadOnly'); + this.hidePasswords = this.getResponseProperty('HidePasswords'); } } diff --git a/src/models/view/cipherView.ts b/src/models/view/cipherView.ts index e1c8d5fa66..4cd0daf039 100644 --- a/src/models/view/cipherView.ts +++ b/src/models/view/cipherView.ts @@ -21,6 +21,7 @@ export class CipherView implements View { favorite = false; organizationUseTotp = false; edit = false; + viewPassword = true; localData: any; login = new LoginView(); identity = new IdentityView(); @@ -44,6 +45,7 @@ export class CipherView implements View { this.favorite = c.favorite; this.organizationUseTotp = c.organizationUseTotp; this.edit = c.edit; + this.viewPassword = c.viewPassword; this.type = c.type; this.localData = c.localData; this.collectionIds = c.collectionIds; diff --git a/src/models/view/collectionView.ts b/src/models/view/collectionView.ts index 622a9e4cf0..9c27c9fb58 100644 --- a/src/models/view/collectionView.ts +++ b/src/models/view/collectionView.ts @@ -11,6 +11,7 @@ export class CollectionView implements View, ITreeNodeObject { name: string = null; externalId: string = null; readOnly: boolean = null; + hidePasswords: boolean = null; constructor(c?: Collection | CollectionGroupDetailsResponse) { if (!c) { @@ -22,6 +23,7 @@ export class CollectionView implements View, ITreeNodeObject { this.externalId = c.externalId; if (c instanceof Collection) { this.readOnly = c.readOnly; + this.hidePasswords = c.hidePasswords; } } } diff --git a/src/models/view/fieldView.ts b/src/models/view/fieldView.ts index 20d695da15..c839e1ecb6 100644 --- a/src/models/view/fieldView.ts +++ b/src/models/view/fieldView.ts @@ -8,6 +8,7 @@ export class FieldView implements View { name: string = null; value: string = null; type: FieldType = null; + newField: boolean = false; // Marks if the field is new and hasn't been saved constructor(f?: Field) { if (!f) {