1
0
mirror of https://github.com/bitwarden/browser synced 2024-12-25 01:22:26 +01:00

export/import custom fields for organizations

This commit is contained in:
Kyle Spearrin 2017-10-03 09:46:53 -04:00
parent 8291fa0ce1
commit a132ec4fd7
5 changed files with 59 additions and 11 deletions

View File

@ -1,6 +1,6 @@
{
"name": "bitwarden",
"version": "1.17.2",
"version": "1.17.3",
"env": "Production",
"devDependencies": {
"connect": "3.6.3",

View File

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

View File

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

View File

@ -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"});

View File

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