diff --git a/src/models/api/requestModels.js b/src/models/api/requestModels.js index ea3951ad..b9992daf 100644 --- a/src/models/api/requestModels.js +++ b/src/models/api/requestModels.js @@ -1,5 +1,5 @@ -var CipherRequest = function (cipher, type) { - this.type = type; +var CipherRequest = function (cipher) { + this.type = cipher.type; this.folderId = cipher.folderId; this.organizationId = cipher.organizationId; this.name = cipher.name ? cipher.name.encryptedString : null; @@ -7,7 +7,7 @@ this.favorite = cipher.favorite; var constantsService = chrome.extension.getBackgroundPage().bg_constantsService; - switch (type) { + switch (this.type) { case constantsService.cipherType.login: this.login = { uri: cipher.login.uri ? cipher.login.uri.encryptedString : null, diff --git a/src/models/domainModels.js b/src/models/domainModels.js index 1371144b..c8ca45e3 100644 --- a/src/models/domainModels.js +++ b/src/models/domainModels.js @@ -420,15 +420,33 @@ function buildDomainModel(model, obj, map, alreadyEncrypted, notEncList) { break; case self.constantsService.cipherType.secureNote: model.secureNote = decObj; - model.subTitle = '-'; + model.subTitle = null; break; case self.constantsService.cipherType.card: model.card = decObj; - model.subTitle = model.identity.brand; + model.subTitle = model.card.brand; + if (model.card.brand) { + model.subTitle = model.card.brand; + } + if (model.card.number && model.card.number.length >= 4) { + if (model.subTitle !== '') { + model.subTitle += ', '; + } + model.subTitle += ('*' + model.card.number.substr(model.card.number.length - 4)); + } break; case self.constantsService.cipherType.identity: model.identity = decObj; - model.subTitle = model.identity.firstName; + model.subTitle = ''; + if (model.identity.firstName) { + model.subTitle = model.identity.firstName; + } + if (model.identity.lastName) { + if (model.subTitle !== '') { + model.subTitle += ' '; + } + model.subTitle += model.identity.lastName; + } break; default: break; diff --git a/src/services/loginService.js b/src/services/loginService.js index c6584518..6a3c8b93 100644 --- a/src/services/loginService.js +++ b/src/services/loginService.js @@ -314,8 +314,7 @@ function initLoginService() { var deferred = Q.defer(); var self = this, - // TODO - request = new CipherRequest(cipher, 1); // 1 = Login + request = new CipherRequest(cipher); if (!cipher.id) { self.apiService.postCipher(request).then(apiSuccess, function (response) {