multi uri support for import/export

This commit is contained in:
Kyle Spearrin 2018-03-02 22:13:53 -05:00
parent 5c92350ed2
commit 27e68e4c75
3 changed files with 111 additions and 71 deletions

View File

@ -26,8 +26,9 @@
return; return;
} }
var i;
var collectionsDict = {}; var collectionsDict = {};
for (var i = 0; i < decCollections.length; i++) { for (i = 0; i < decCollections.length; i++) {
collectionsDict[decCollections[i].id] = decCollections[i]; collectionsDict[decCollections[i].id] = decCollections[i];
} }
@ -78,10 +79,17 @@
switch (decCiphers[i].type) { switch (decCiphers[i].type) {
case constants.cipherType.login: case constants.cipherType.login:
cipher.type = 'login'; cipher.type = 'login';
cipher.login_uri = decCiphers[i].login.uri; cipher.login_uri = null;
cipher.login_username = decCiphers[i].login.username; cipher.login_username = decCiphers[i].login.username;
cipher.login_password = decCiphers[i].login.password; cipher.login_password = decCiphers[i].login.password;
cipher.login_totp = decCiphers[i].login.totp; cipher.login_totp = decCiphers[i].login.totp;
if (decCiphers[i].login.uris && decCiphers[i].login.uris.length) {
cipher.login_uri = [];
for (j = 0; j < decCiphers[i].login.uris.length; j++) {
cipher.login_uri.push(decCiphers[i].login.uris[j].uri);
}
}
break; break;
case constants.cipherType.secureNote: case constants.cipherType.secureNote:
cipher.type = 'note'; cipher.type = 'note';

View File

@ -195,10 +195,6 @@
uri = 'http://' + uri; uri = 'http://' + uri;
} }
return trimUri(uri);
}
function trimUri(uri) {
if (uri.length > 1000) { if (uri.length > 1000) {
return uri.substring(0, 1000); return uri.substring(0, 1000);
} }
@ -206,6 +202,43 @@
return uri; return uri;
} }
function makeUriArray(uri) {
if (!uri) {
return null;
}
if (typeof uri === 'string') {
return [{
uri: fixUri(uri),
match: null
}];
}
if (uri.length) {
var returnArr = [];
for (var i = 0; i < uri.length; i++) {
returnArr.push({
uri: fixUri(uri[i]),
match: null
});
}
return returnArr;
}
return null;
}
function parseSingleRowCsv(rowData) {
if (!rowData || rowData === '') {
return null;
}
var parsedRow = Papa.parse(rowData);
if (parsedRow && parsedRow.data && parsedRow.data.length && parsedRow.data[0].length) {
return parsedRow.data[0];
}
return null;
}
function parseCsvErrors(results) { function parseCsvErrors(results) {
if (results.errors && results.errors.length) { if (results.errors && results.errors.length) {
for (var i = 0; i < results.errors.length; i++) { for (var i = 0; i < results.errors.length; i++) {
@ -362,16 +395,18 @@
var valueType = value.type ? value.type.toLowerCase() : null; var valueType = value.type ? value.type.toLowerCase() : null;
switch (valueType) { switch (valueType) {
case 'login': case null: case undefined: case 'login':
case null:
case undefined:
cipher.type = constants.cipherType.login; cipher.type = constants.cipherType.login;
var totp = value.login_totp || value.totp; var totp = value.login_totp || value.totp;
var uri = value.login_uri || value.uri; var uris = parseSingleRowCsv(value.login_uri || value.uri);
var username = value.login_username || value.username; var username = value.login_username || value.username;
var password = value.login_password || value.password; var password = value.login_password || value.password;
cipher.login = { cipher.login = {
totp: totp && totp !== '' ? totp : null, totp: totp && totp !== '' ? totp : null,
uri: uri && uri !== '' ? trimUri(uri) : null, uris: makeUriArray(uris),
username: username && username !== '' ? username : null, username: username && username !== '' ? username : null,
password: password && password !== '' ? password : null password: password && password !== '' ? password : null
}; };
@ -490,16 +525,18 @@
var valueType = value.type ? value.type.toLowerCase() : null; var valueType = value.type ? value.type.toLowerCase() : null;
switch (valueType) { switch (valueType) {
case 'login': case null: case undefined: case 'login':
case null:
case undefined:
cipher.type = constants.cipherType.login; cipher.type = constants.cipherType.login;
var totp = value.login_totp || value.totp; var totp = value.login_totp || value.totp;
var uri = value.login_uri || value.uri; var uris = parseSingleRowCsv(value.login_uri || value.uri);
var username = value.login_username || value.username; var username = value.login_username || value.username;
var password = value.login_password || value.password; var password = value.login_password || value.password;
cipher.login = { cipher.login = {
totp: totp && totp !== '' ? totp : null, totp: totp && totp !== '' ? totp : null,
uri: uri && uri !== '' ? trimUri(uri) : null, uris: makeUriArray(uris),
username: username && username !== '' ? username : null, username: username && username !== '' ? username : null,
password: password && password !== '' ? password : null password: password && password !== '' ? password : null
}; };
@ -686,7 +723,7 @@
if (cipher.type === constants.cipherType.login) { if (cipher.type === constants.cipherType.login) {
cipher.login = { cipher.login = {
uri: value.url && value.url !== '' ? trimUri(value.url) : null, uris: makeUriArray(value.url),
username: value.username && value.username !== '' ? value.username : null, username: value.username && value.username !== '' ? value.username : null,
password: value.password && value.password !== '' ? value.password : null password: value.password && value.password !== '' ? value.password : null
}; };
@ -879,7 +916,7 @@
cipher.notes += (text + '\n'); cipher.notes += (text + '\n');
} }
else if (type === 'weblogin' || type === 'website') { else if (type === 'weblogin' || type === 'website') {
cipher.login.uri = trimUri(text); cipher.login.uris = makeUriArray(text);
} }
else if (text.length > 200) { else if (text.length > 200) {
cipher.notes += (name + ': ' + text + '\n'); cipher.notes += (name + ': ' + text + '\n');
@ -980,7 +1017,7 @@
notes: null, notes: null,
name: value[0] && value[0] !== '' ? value[0] : '--', name: value[0] && value[0] !== '' ? value[0] : '--',
login: { login: {
uri: null, uris: null,
username: value[2] && value[2] !== '' ? value[2] : null, username: value[2] && value[2] !== '' ? value[2] : null,
password: value[3] && value[3] !== '' ? value[3] : null password: value[3] && value[3] !== '' ? value[3] : null
}, },
@ -996,7 +1033,7 @@
var cfHeader = customFieldHeaders[j - 4]; var cfHeader = customFieldHeaders[j - 4];
if (cfHeader.toLowerCase() === 'url' || cfHeader.toLowerCase() === 'uri') { if (cfHeader.toLowerCase() === 'url' || cfHeader.toLowerCase() === 'uri') {
cipher.login.uri = trimUri(cf); cipher.login.uris = makeUriArray(cf);
} }
else { else {
if (!cipher.fields) { if (!cipher.fields) {
@ -1082,7 +1119,7 @@
name: null, name: null,
type: constants.cipherType.login, type: constants.cipherType.login,
login: { login: {
uri: null, uris: null,
username: null, username: null,
password: null password: null
}, },
@ -1101,7 +1138,7 @@
switch (key) { switch (key) {
case 'URL': case 'URL':
cipher.login.uri = fixUri(value); cipher.login.uris = makeUriArray(value);
break; break;
case 'UserName': case 'UserName':
cipher.login.username = value; cipher.login.username = value;
@ -1203,7 +1240,7 @@
notes: value.Notes && value.Notes !== '' ? value.Notes : null, notes: value.Notes && value.Notes !== '' ? value.Notes : null,
name: value.Title && value.Title !== '' ? value.Title : '--', name: value.Title && value.Title !== '' ? value.Title : '--',
login: { login: {
uri: value.URL && value.URL !== '' ? fixUri(value.URL) : null, uris: makeUriArray(value.URL),
username: value.Username && value.Username !== '' ? value.Username : null, username: value.Username && value.Username !== '' ? value.Username : null,
password: value.Password && value.Password !== '' ? value.Password : null password: value.Password && value.Password !== '' ? value.Password : null
} }
@ -1316,7 +1353,7 @@
else { else {
cipher.type = constants.cipherType.login; cipher.type = constants.cipherType.login;
cipher.login = { cipher.login = {
uri: item.location && item.location !== '' ? fixUri(item.location) : null, uris: makeUriArray(item.location),
username: null, username: null,
password: null, password: null,
totp: null totp: null
@ -1371,7 +1408,7 @@
notes: value.notesPlain && value.notesPlain !== '' ? value.notesPlain : '', notes: value.notesPlain && value.notesPlain !== '' ? value.notesPlain : '',
name: value.title && value.title !== '' ? value.title : '--', name: value.title && value.title !== '' ? value.title : '--',
login: { login: {
uri: null, uris: null,
username: null, username: null,
password: null password: null
} }
@ -1389,17 +1426,9 @@
else if (!cipher.login.username && property === 'username') { else if (!cipher.login.username && property === 'username') {
cipher.login.username = value[property]; cipher.login.username = value[property];
} }
else if (!cipher.login.uri && property === 'urls') { else if (!cipher.login.uris && property === 'urls') {
var urls = value[property].split(/(?:\r\n|\r|\n)/); var urls = value[property].split(/(?:\r\n|\r|\n)/);
cipher.login.uri = fixUri(urls[0]); cipher.login.uris = makeUriArray(urls);
for (var j = 1; j < urls.length; j++) {
if (cipher.notes !== '') {
cipher.notes += '\n';
}
cipher.notes += ('url ' + (j + 1) + ': ' + urls[j]);
}
} }
else if (property !== 'ainfo' && property !== 'autosubmit' && property !== 'notesPlain' && else if (property !== 'ainfo' && property !== 'autosubmit' && property !== 'notesPlain' &&
property !== 'ps' && property !== 'scope' && property !== 'tags' && property !== 'title' && property !== 'ps' && property !== 'scope' && property !== 'tags' && property !== 'title' &&
@ -1443,7 +1472,7 @@
notes: null, notes: null,
name: value.name && value.name !== '' ? value.name : '--', name: value.name && value.name !== '' ? value.name : '--',
login: { login: {
uri: value.url && value.url !== '' ? trimUri(value.url) : null, uris: makeUriArray(value.url),
username: value.username && value.username !== '' ? value.username : null, username: value.username && value.username !== '' ? value.username : null,
password: value.password && value.password !== '' ? value.password : null password: value.password && value.password !== '' ? value.password : null
} }
@ -1497,7 +1526,7 @@
notes: null, notes: null,
name: getNameFromHost(host), name: getNameFromHost(host),
login: { login: {
uri: host && host !== '' ? trimUri(host) : null, uris: makeUriArray(host),
username: user && user !== '' ? user : null, username: user && user !== '' ? user : null,
password: password && password !== '' ? password : null, password: password && password !== '' ? password : null,
} }
@ -1533,7 +1562,7 @@
notes: value[4] && value[4] !== '' ? value[4] : null, notes: value[4] && value[4] !== '' ? value[4] : null,
name: value[0] && value[0] !== '' ? value[0] : '--', name: value[0] && value[0] !== '' ? value[0] : '--',
login: { login: {
uri: value[3] && value[3] !== '' ? trimUri(value[3]) : null, uris: makeUriArray(value[3]),
username: value[1] && value[1] !== '' ? value[1] : null, username: value[1] && value[1] !== '' ? value[1] : null,
password: value[2] && value[2] !== '' ? value[2] : null password: value[2] && value[2] !== '' ? value[2] : null
} }
@ -1580,7 +1609,7 @@
notes: value[5] && value[5] !== '' ? value[5] : null, notes: value[5] && value[5] !== '' ? value[5] : null,
name: value[1] && value[1] !== '' ? value[1] : '--', name: value[1] && value[1] !== '' ? value[1] : '--',
login: { login: {
uri: value[4] && value[4] !== '' ? trimUri(value[4]) : null, uris: makeUriArray(value[4]),
username: value[2] && value[2] !== '' ? value[2] : null, username: value[2] && value[2] !== '' ? value[2] : null,
password: value[3] && value[3] !== '' ? value[3] : null password: value[3] && value[3] !== '' ? value[3] : null
}, },
@ -1688,7 +1717,7 @@
notes: notes && notes.text() !== '' ? notes.text() : null, notes: notes && notes.text() !== '' ? notes.text() : null,
name: accountName && accountName.text() !== '' ? accountName.text() : '--', name: accountName && accountName.text() !== '' ? accountName.text() : '--',
login: { login: {
uri: url && url.text() !== '' ? trimUri(url.text()) : null, uris: url ? makeUriArray(url.text()) : null,
username: userId && userId.text() !== '' ? userId.text() : null, username: userId && userId.text() !== '' ? userId.text() : null,
password: password && password.text() !== '' ? password.text() : null password: password && password.text() !== '' ? password.text() : null
}, },
@ -1788,7 +1817,7 @@
notes: note && note !== '' ? note : null, notes: note && note !== '' ? note : null,
fields: null, fields: null,
login: { login: {
uri: null, uris: null,
password: null, password: null,
username: null, username: null,
totp: null totp: null
@ -1805,8 +1834,8 @@
var field = row[i + 1]; var field = row[i + 1];
var fieldLower = field.toLowerCase(); var fieldLower = field.toLowerCase();
if (fieldLower === 'url' && !cipher.login.uri) { if (fieldLower === 'url' && !cipher.login.uris) {
cipher.login.uri = trimUri(value); cipher.login.uris = makeUriArray(value);
} }
else if ((fieldLower === 'username' || fieldLower === 'email') && !cipher.login.username) { else if ((fieldLower === 'username' || fieldLower === 'email') && !cipher.login.username) {
cipher.login.username = value; cipher.login.username = value;
@ -1907,7 +1936,7 @@
notes: notes && notesText !== '' ? notesText : null, notes: notes && notesText !== '' ? notesText : null,
name: title && title.text() !== '' ? title.text() : '--', name: title && title.text() !== '' ? title.text() : '--',
login: { login: {
uri: url && url.text() !== '' ? trimUri(url.text()) : null, uris: url ? makeUriArray(url.text()) : null,
username: username && username.text() !== '' ? username.text() : null, username: username && username.text() !== '' ? username.text() : null,
password: password && password.text() !== '' ? password.text() : null password: password && password.text() !== '' ? password.text() : null
} }
@ -1969,17 +1998,17 @@
favorite: false, favorite: false,
notes: null, notes: null,
login: { login: {
uri: null, uris: null,
password: null, password: null,
username: null username: null
} }
}; };
if (row.length === 2) { if (row.length === 2) {
cipher.login.uri = fixUri(row[1]); cipher.login.uris = makeUriArray(row[1]);
} }
else if (row.length === 3) { else if (row.length === 3) {
cipher.login.uri = fixUri(row[1]); cipher.login.uris = makeUriArray(row[1]);
cipher.login.username = row[2]; cipher.login.username = row[2];
} }
else if (row.length === 4) { else if (row.length === 4) {
@ -1993,7 +2022,7 @@
} }
} }
else if (row.length === 5) { else if (row.length === 5) {
cipher.login.uri = fixUri(row[1]); cipher.login.uris = makeUriArray(row[1]);
cipher.login.username = row[2]; cipher.login.username = row[2];
cipher.login.password = row[3]; cipher.login.password = row[3];
cipher.notes = row[4]; cipher.notes = row[4];
@ -2010,7 +2039,7 @@
cipher.notes = row[4] + '\n' + row[5]; cipher.notes = row[4] + '\n' + row[5];
} }
cipher.login.uri = fixUri(row[1]); cipher.login.uris = makeUriArray(row[1]);
} }
else if (row.length === 7) { else if (row.length === 7) {
if (row[2] === '') { if (row[2] === '') {
@ -2022,7 +2051,7 @@
cipher.notes = row[3] + '\n' + row[4] + '\n' + row[6]; cipher.notes = row[3] + '\n' + row[4] + '\n' + row[6];
} }
cipher.login.uri = fixUri(row[1]); cipher.login.uris = makeUriArray(row[1]);
cipher.login.password = row[5]; cipher.login.password = row[5];
} }
else { else {
@ -2049,9 +2078,6 @@
if (cipher.notes === '') { if (cipher.notes === '') {
cipher.notes = null; cipher.notes = null;
} }
if (cipher.login.uri === '') {
cipher.login.uri = null;
}
ciphers.push(cipher); ciphers.push(cipher);
} }
@ -2144,7 +2170,7 @@
notes: notesText && notesText !== '' ? notesText : null, notes: notesText && notesText !== '' ? notesText : null,
name: titleText && titleText !== '' ? titleText : '--', name: titleText && titleText !== '' ? titleText : '--',
login: { login: {
uri: linkText && linkText !== '' ? trimUri(linkText) : null, uris: makeUriArray(linkText),
username: usernameText && usernameText !== '' ? usernameText : null, username: usernameText && usernameText !== '' ? usernameText : null,
password: passwordText && passwordText !== '' ? passwordText : null password: passwordText && passwordText !== '' ? passwordText : null
} }
@ -2210,14 +2236,14 @@
notes: '', notes: '',
name: value[2] && value[2] !== '' ? value[2] : null, name: value[2] && value[2] !== '' ? value[2] : null,
login: { login: {
uri: null, uris: null,
username: null, username: null,
password: null password: null
} }
}; };
if (value[1] === 'Web Logins') { if (value[1] === 'Web Logins') {
cipher.login.uri = value[4] && value[4] !== '' ? trimUri(value[4]) : null; cipher.login.uris = makeUriArray(value[4]);
cipher.login.username = value[5] && value[5] !== '' ? value[5] : null; cipher.login.username = value[5] && value[5] !== '' ? value[5] : null;
cipher.login.password = value[6] && value[6] !== '' ? value[6] : null; cipher.login.password = value[6] && value[6] !== '' ? value[6] : null;
cipher.notes = value[3] && value[3] !== '' ? value[3].split('\\n').join('\n') : null; cipher.notes = value[3] && value[3] !== '' ? value[3].split('\\n').join('\n') : null;
@ -2295,7 +2321,7 @@
notes: value.memo && value.memo !== '' ? value.memo : null, notes: value.memo && value.memo !== '' ? value.memo : null,
name: value.name && value.name !== '' ? value.name : '--', name: value.name && value.name !== '' ? value.name : '--',
login: { login: {
uri: value.url && value.url !== '' ? trimUri(value.url) : null, uris: makeUriArray(value.url),
username: value.login && value.login !== '' ? value.login : null, username: value.login && value.login !== '' ? value.login : null,
password: value.password && value.password !== '' ? value.password : null password: value.password && value.password !== '' ? value.password : null
}, },
@ -2367,7 +2393,7 @@
notes: '', notes: '',
name: entry.label && entry.label !== '' ? entry.label.split(' ')[0] : '--', name: entry.label && entry.label !== '' ? entry.label.split(' ')[0] : '--',
login: { login: {
uri: null, uris: null,
username: null, username: null,
password: null password: null
}, },
@ -2395,7 +2421,7 @@
cipher.login.username = field.value; cipher.login.username = field.value;
break; break;
case 'url': case 'url':
cipher.login.uri = trimUri(field.value); cipher.login.uris = makeUriArray(field.value);
break; break;
default: default:
if (!cipher.login.username && isField(field.label, _usernameFieldNames)) { if (!cipher.login.username && isField(field.label, _usernameFieldNames)) {
@ -2458,7 +2484,7 @@
notes: null, notes: null,
name: account.label && account.label !== '' ? account.label : account.domain, name: account.label && account.label !== '' ? account.label : account.domain,
login: { login: {
uri: account.domain && account.domain !== '' ? fixUri(account.domain) : null, uris: makeUriArray(account.domain),
username: account.username && account.username !== '' ? account.username : null, username: account.username && account.username !== '' ? account.username : null,
password: account.password && account.password !== '' ? account.password : null password: account.password && account.password !== '' ? account.password : null
} }
@ -2504,7 +2530,7 @@
notes: '', notes: '',
name: outterTable.find('span.caption').text(), name: outterTable.find('span.caption').text(),
login: { login: {
uri: null, uris: null,
username: null, username: null,
password: null password: null
}, },
@ -2513,7 +2539,7 @@
var url = outterTable.find('.subcaption').text(); var url = outterTable.find('.subcaption').text();
if (url && url !== '') { if (url && url !== '') {
cipher.login.uri = fixUri(url); cipher.login.uris = makeUriArray(url);
} }
var fields = []; var fields = [];
@ -2597,7 +2623,7 @@
notes: value.notes && value.notes !== '' ? value.notes : null, notes: value.notes && value.notes !== '' ? value.notes : null,
name: value.url && value.url !== '' ? urlDomain(value.url) : '--', name: value.url && value.url !== '' ? urlDomain(value.url) : '--',
login: { login: {
uri: value.url && value.url !== '' ? trimUri(value.url) : null, uris: makeUriArray(value.url),
username: value.username && value.username !== '' ? value.username : null, username: value.username && value.username !== '' ? value.username : null,
password: value.password && value.password !== '' ? value.password : null password: value.password && value.password !== '' ? value.password : null
} }
@ -2631,7 +2657,7 @@
favorite: false, favorite: false,
notes: note && note !== '' ? note : null, notes: note && note !== '' ? note : null,
login: { login: {
uri: null, uris: null,
password: null, password: null,
username: null username: null
}, },
@ -2648,8 +2674,8 @@
var fieldLower = field.toLowerCase(); var fieldLower = field.toLowerCase();
if (!cipher.login.uri && isField(field, _uriFieldNames)) { if (!cipher.login.uris && isField(field, _uriFieldNames)) {
cipher.login.uri = fixUri(value); cipher.login.uris = makeUriArray(value);
} }
else if (!cipher.login.username && isField(field, _usernameFieldNames)) { else if (!cipher.login.username && isField(field, _usernameFieldNames)) {
cipher.login.username = value; cipher.login.username = value;
@ -2706,7 +2732,7 @@
notes: '', notes: '',
name: item.name && item.name !== '' ? item.name : '--', name: item.name && item.name !== '' ? item.name : '--',
login: { login: {
uri: item.login_url && item.login_url !== '' ? fixUri(item.login_url) : null, uris: makeUriArray(item.login_url),
username: null, username: null,
password: null password: null
}, },
@ -2850,7 +2876,7 @@
notes: value.Notes && value.Notes !== '' ? value.Notes : '', notes: value.Notes && value.Notes !== '' ? value.Notes : '',
name: value['Secret Name'] && value['Secret Name'] !== '' ? value['Secret Name'] : '--', name: value['Secret Name'] && value['Secret Name'] !== '' ? value['Secret Name'] : '--',
login: { login: {
uri: value['Secret URL'] && value['Secret URL'] !== '' ? fixUri(value['Secret URL']) : null, uris: makeUriArray(value['Secret URL']),
username: null, username: null,
password: null password: null
}, },
@ -2950,15 +2976,15 @@
name: value[1] && value[1] !== '' ? value[1] : '--', name: value[1] && value[1] !== '' ? value[1] : '--',
fields: null, fields: null,
login: { login: {
uri: null, uris: null,
username: null, username: null,
password: null password: null
} }
}; };
if (type === 'Web Logins' || type === 'Servers' || type === 'Email Accounts') { if (type === 'Web Logins' || type === 'Servers' || type === 'Email Accounts') {
cipher.login.uri = value[4] && value[4] !== '' ? fixUri(value[4]) : null; cipher.login.uris = makeUriArray(value[4]),
cipher.login.username = value[2] && value[2] !== '' ? value[2] : null; cipher.login.username = value[2] && value[2] !== '' ? value[2] : null;
cipher.login.password = value[3] && value[3] !== '' ? value[3] : null; cipher.login.password = value[3] && value[3] !== '' ? value[3] : null;
parseFieldsToNotes(5, value, cipher); parseFieldsToNotes(5, value, cipher);
} }
@ -3015,7 +3041,7 @@
favorite: false, favorite: false,
notes: row.Notes && row.Notes !== '' ? row.Notes : null, notes: row.Notes && row.Notes !== '' ? row.Notes : null,
login: { login: {
uri: row.Url && row.Url !== '' ? fixUri(row.Url) : null, uris: makeUriArray(row.Url),
password: row.Password && row.Password !== '' ? row.Password : null, password: row.Password && row.Password !== '' ? row.Password : null,
username: row.UserName && row.UserName !== '' ? row.UserName : null username: row.UserName && row.UserName !== '' ? row.UserName : null
} }
@ -3072,7 +3098,7 @@
notes: !!getValue('description', value) ? getValue('description', value) : null, notes: !!getValue('description', value) ? getValue('description', value) : null,
name: !!getValue('title', value) ? getValue('title', value) : '--', name: !!getValue('title', value) ? getValue('title', value) : '--',
login: { login: {
uri: !!getValue('site', value) ? fixUri(getValue('site', value)) : null, uris: !!getValue('site', value) ? makeUriArray(getValue('site', value)) : null,
username: !!getValue('username', value) ? getValue('username', value) : null, username: !!getValue('username', value) ? getValue('username', value) : null,
password: !!getValue('password', value) ? getValue('password', value) : null password: !!getValue('password', value) ? getValue('password', value) : null
} }
@ -3146,7 +3172,7 @@
notes: '', notes: '',
name: item.display_name.replace('http://', '').replace('https://', ''), name: item.display_name.replace('http://', '').replace('https://', ''),
login: { login: {
uri: fixUri(item.display_name), uris: makeUriArray(item.display_name),
username: item.attributes.username_value && item.attributes.username_value !== '' ? username: item.attributes.username_value && item.attributes.username_value !== '' ?
item.attributes.username_value : null, item.attributes.username_value : null,
password: item.secret && item.secret !== '' ? item.secret : null password: item.secret && item.secret !== '' ? item.secret : null

View File

@ -69,10 +69,16 @@
switch (decCiphers[i].type) { switch (decCiphers[i].type) {
case constants.cipherType.login: case constants.cipherType.login:
cipher.type = 'login'; cipher.type = 'login';
cipher.login_uri = decCiphers[i].login.uri;
cipher.login_username = decCiphers[i].login.username; cipher.login_username = decCiphers[i].login.username;
cipher.login_password = decCiphers[i].login.password; cipher.login_password = decCiphers[i].login.password;
cipher.login_totp = decCiphers[i].login.totp; cipher.login_totp = decCiphers[i].login.totp;
if (decCiphers[i].login.uris && decCiphers[i].login.uris.length) {
cipher.login_uri = [];
for (j = 0; j < decCiphers[i].login.uris.length; j++) {
cipher.login_uri.push(decCiphers[i].login.uris[j].uri);
}
}
break; break;
case constants.cipherType.secureNote: case constants.cipherType.secureNote:
cipher.type = 'note'; cipher.type = 'note';