diff --git a/package.json b/package.json index dbd6562f16..8d4e430a3f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bitwarden", - "version": "1.17.2", + "version": "1.17.3", "env": "Production", "devDependencies": { "connect": "3.6.3", diff --git a/src/app/organization/organizationSettingsExportController.js b/src/app/organization/organizationSettingsExportController.js index 874b918d43..9288e42492 100644 --- a/src/app/organization/organizationSettingsExportController.js +++ b/src/app/organization/organizationSettingsExportController.js @@ -46,11 +46,26 @@ password: decLogins[i].password, notes: decLogins[i].notes, totp: decLogins[i].totp, - collections: [] + collections: [], + fields: null }; + var j; + if (decLogins[i].fields) { + for (j = 0; j < decLogins[i].fields.length; j++) { + if (!login.fields) { + login.fields = ''; + } + else { + login.fields += '\n'; + } + + login.fields += ((decLogins[i].fields[j].name || '') + ': ' + decLogins[i].fields[j].value); + } + } + if (decLogins[i].collectionIds) { - for (var j = 0; j < decLogins[i].collectionIds.length; j++) { + for (j = 0; j < decLogins[i].collectionIds.length; j++) { if (collectionsDict.hasOwnProperty(decLogins[i].collectionIds[j])) { login.collections.push(collectionsDict[decLogins[i].collectionIds[j]].name); } diff --git a/src/app/services/importService.js b/src/app/services/importService.js index f01425b816..8c43322524 100644 --- a/src/app/services/importService.js +++ b/src/app/services/importService.js @@ -292,7 +292,7 @@ name: fields[i].substr(0, delimPosition), value: null, type: 0 - } + }; if (fields[i].length > (delimPosition + 2)) { field.value = fields[i].substr(delimPosition + 2); @@ -333,7 +333,8 @@ var collections = [], logins = [], - collectionRelationships = []; + collectionRelationships = [], + i; angular.forEach(results.data, function (value, key) { var loginIndex = logins.length; @@ -341,7 +342,7 @@ if (value.collections && value.collections !== '') { var loginCollections = value.collections.split(','); - for (var i = 0; i < loginCollections.length; i++) { + for (i = 0; i < loginCollections.length; i++) { var addCollection = true; var collectionIndex = collections.length; @@ -366,15 +367,47 @@ } } - logins.push({ + var login = { favorite: false, uri: value.uri && value.uri !== '' ? trimUri(value.uri) : null, username: value.username && value.username !== '' ? value.username : null, password: value.password && value.password !== '' ? value.password : null, notes: value.notes && value.notes !== '' ? value.notes : null, name: value.name && value.name !== '' ? value.name : '--', - totp: value.totp && value.totp !== '' ? value.totp : null - }); + totp: value.totp && value.totp !== '' ? value.totp : null, + }; + + if (value.fields && value.fields !== '') { + var fields = value.fields.split('\n'); + for (i = 0; i < fields.length; i++) { + if (!fields[i] || fields[i] === '') { + continue; + } + + var delimPosition = fields[i].lastIndexOf(': '); + if (delimPosition === -1) { + continue; + } + + if (!login.fields) { + login.fields = []; + } + + var field = { + name: fields[i].substr(0, delimPosition), + value: null, + type: 0 + }; + + if (fields[i].length > (delimPosition + 2)) { + field.value = fields[i].substr(delimPosition + 2); + } + + login.fields.push(field); + } + } + + logins.push(login); }); success(collections, logins, collectionRelationships); diff --git a/src/app/settings.js b/src/app/settings.js index 2b88306c7b..1dfc9d0831 100644 --- a/src/app/settings.js +++ b/src/app/settings.js @@ -1,2 +1,2 @@ angular.module("bit") -.constant("appSettings", {"apiUri":"https://api.bitwarden.com","identityUri":"https://identity.bitwarden.com","stripeKey":"pk_live_bpN0P37nMxrMQkcaHXtAybJk","braintreeKey":"production_qfbsv8kc_njj2zjtyngtjmbjd","whitelistDomains":["api.bitwarden.com"],"selfHosted":false,"version":"1.17.1","environment":"Production"}); +.constant("appSettings", {"apiUri":"https://api.bitwarden.com","identityUri":"https://identity.bitwarden.com","stripeKey":"pk_live_bpN0P37nMxrMQkcaHXtAybJk","braintreeKey":"production_qfbsv8kc_njj2zjtyngtjmbjd","whitelistDomains":["api.bitwarden.com"],"selfHosted":false,"version":"1.17.3","environment":"Production"}); diff --git a/src/app/tools/toolsExportController.js b/src/app/tools/toolsExportController.js index 834c0333c5..2177f35bbd 100644 --- a/src/app/tools/toolsExportController.js +++ b/src/app/tools/toolsExportController.js @@ -54,7 +54,7 @@ login.fields += '\n'; } - login.fields += (decLogins[i].fields[j].name + ': ' + decLogins[i].fields[j].value); + login.fields += ((decLogins[i].fields[j].name || '') + ': ' + decLogins[i].fields[j].value); } }