diff --git a/src/angular/components/add-edit.component.ts b/src/angular/components/add-edit.component.ts index c3a8cdea27..08cb58c471 100644 --- a/src/angular/components/add-edit.component.ts +++ b/src/angular/components/add-edit.component.ts @@ -228,6 +228,7 @@ export class AddEditComponent implements OnInit { this.cipher.identity = new IdentityView(); this.cipher.secureNote = new SecureNoteView(); this.cipher.secureNote.type = SecureNoteType.Generic; + this.cipher.reprompt = CipherRepromptType.None; } } diff --git a/src/importers/baseImporter.ts b/src/importers/baseImporter.ts index ac1bf8486a..194d58430b 100644 --- a/src/importers/baseImporter.ts +++ b/src/importers/baseImporter.ts @@ -15,6 +15,7 @@ import { FolderView } from '../models/view/folderView'; import { LoginView } from '../models/view/loginView'; import { SecureNoteView } from '../models/view/secureNoteView'; +import { CipherRepromptType } from '../enums/cipherRepromptType'; import { CipherType } from '../enums/cipherType'; import { FieldType } from '../enums/fieldType'; import { SecureNoteType } from '../enums/secureNoteType'; diff --git a/src/importers/bitwardenCsvImporter.ts b/src/importers/bitwardenCsvImporter.ts index 65a123d37b..f2ffeae592 100644 --- a/src/importers/bitwardenCsvImporter.ts +++ b/src/importers/bitwardenCsvImporter.ts @@ -10,6 +10,7 @@ import { FolderView } from '../models/view/folderView'; import { LoginView } from '../models/view/loginView'; import { SecureNoteView } from '../models/view/secureNoteView'; +import { CipherRepromptType } from '../enums/cipherRepromptType'; import { CipherType } from '../enums/cipherType'; import { FieldType } from '../enums/fieldType'; import { SecureNoteType } from '../enums/secureNoteType'; @@ -55,6 +56,13 @@ export class BitwardenCsvImporter extends BaseImporter implements Importer { cipher.type = CipherType.Login; cipher.notes = this.getValueOrDefault(value.notes); cipher.name = this.getValueOrDefault(value.name, '--'); + try { + cipher.reprompt = parseInt(this.getValueOrDefault(value.reprompt, CipherRepromptType.None.toString()), 10); + } catch (e) { + // tslint:disable-next-line + console.error('Unable to parse reprompt value', e); + cipher.reprompt = CipherRepromptType.None; + } if (!this.isNullOrWhitespace(value.fields)) { const fields = this.splitNewLine(value.fields); diff --git a/src/models/export/cipher.ts b/src/models/export/cipher.ts index 2c5b3e41cb..6f05077654 100644 --- a/src/models/export/cipher.ts +++ b/src/models/export/cipher.ts @@ -1,3 +1,4 @@ +import { CipherRepromptType } from '../../enums/cipherRepromptType'; import { CipherType } from '../../enums/cipherType'; import { CipherView } from '../view/cipherView'; @@ -26,6 +27,7 @@ export class Cipher { req.secureNote = null; req.card = null; req.identity = null; + req.reprompt = CipherRepromptType.None; return req; } @@ -42,6 +44,7 @@ export class Cipher { view.name = req.name; view.notes = req.notes; view.favorite = req.favorite; + view.reprompt = req.reprompt ?? CipherRepromptType.None; if (req.fields != null) { view.fields = req.fields.map(f => Field.toView(f)); @@ -74,6 +77,7 @@ export class Cipher { domain.name = req.name != null ? new EncString(req.name) : null; domain.notes = req.notes != null ? new EncString(req.notes) : null; domain.favorite = req.favorite; + domain.reprompt = req.reprompt ?? CipherRepromptType.None; if (req.fields != null) { domain.fields = req.fields.map(f => Field.toDomain(f)); @@ -109,12 +113,14 @@ export class Cipher { secureNote: SecureNote; card: Card; identity: Identity; + reprompt: CipherRepromptType; // Use build method instead of ctor so that we can control order of JSON stringify for pretty print build(o: CipherView | CipherDomain) { this.organizationId = o.organizationId; this.folderId = o.folderId; this.type = o.type; + this.reprompt = o.reprompt; if (o instanceof CipherView) { this.name = o.name; diff --git a/src/models/view/cipherView.ts b/src/models/view/cipherView.ts index f4548f60c3..466ba9ab02 100644 --- a/src/models/view/cipherView.ts +++ b/src/models/view/cipherView.ts @@ -34,7 +34,7 @@ export class CipherView implements View { collectionIds: string[] = null; revisionDate: Date = null; deletedDate: Date = null; - reprompt: CipherRepromptType = null; + reprompt: CipherRepromptType = CipherRepromptType.None; constructor(c?: Cipher) { if (!c) { diff --git a/src/services/export.service.ts b/src/services/export.service.ts index a53ce3d104..78adb484a8 100644 --- a/src/services/export.service.ts +++ b/src/services/export.service.ts @@ -308,6 +308,7 @@ export class ExportService implements ExportServiceAbstraction { cipher.name = c.name; cipher.notes = c.notes; cipher.fields = null; + cipher.reprompt = c.reprompt; // Login props cipher.login_uri = null; cipher.login_username = null;