mirror of
https://github.com/bitwarden/browser.git
synced 2024-09-06 00:48:08 +02:00
Merge pull request #104 from Hinton/feature/hide-passwords
Add support for collections with hide passwords
This commit is contained in:
commit
2b6657a293
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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<CollectionView> {
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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');
|
||||
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user