1
0
mirror of https://github.com/bitwarden/desktop.git synced 2024-09-30 04:18:01 +02:00

more fixes

This commit is contained in:
Kyle Spearrin 2017-10-16 10:20:46 -04:00
parent 176b9a8ed0
commit fd146afb69
3 changed files with 25 additions and 8 deletions

View File

@ -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,

View File

@ -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;

View File

@ -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) {