mirror of
https://github.com/bitwarden/browser.git
synced 2025-01-21 21:11:35 +01:00
added SafeInCloud csv import
This commit is contained in:
parent
1d5f894211
commit
d17211ff86
@ -12,6 +12,9 @@
|
||||
case 'lastpass':
|
||||
importLastPass(file, success, error);
|
||||
break;
|
||||
case 'safeincloud':
|
||||
importSafeInCloud(file, success, error);
|
||||
break;
|
||||
default:
|
||||
error();
|
||||
break;
|
||||
@ -38,7 +41,7 @@
|
||||
|
||||
if (hasFolder) {
|
||||
for (var i = 0; i < folders.length; i++) {
|
||||
if (folders[i].name == value.folder) {
|
||||
if (folders[i].name === value.folder) {
|
||||
addFolder = false;
|
||||
folderIndex = i;
|
||||
break;
|
||||
@ -90,12 +93,12 @@
|
||||
|
||||
var folderIndex = folders.length,
|
||||
siteIndex = sites.length,
|
||||
hasFolder = value.grouping && value.grouping !== '' && value.grouping != '(none)',
|
||||
hasFolder = value.grouping && value.grouping !== '' && value.grouping !== '(none)',
|
||||
addFolder = hasFolder;
|
||||
|
||||
if (hasFolder) {
|
||||
for (var i = 0; i < folders.length; i++) {
|
||||
if (folders[i].name == value.grouping) {
|
||||
if (folders[i].name === value.grouping) {
|
||||
addFolder = false;
|
||||
folderIndex = i;
|
||||
break;
|
||||
@ -104,7 +107,7 @@
|
||||
}
|
||||
|
||||
sites.push({
|
||||
favorite: value.fav == '1',
|
||||
favorite: value.fav === '1',
|
||||
uri: value.url,
|
||||
username: value.username && value.username !== '' ? value.username : null,
|
||||
password: value.password,
|
||||
@ -132,5 +135,29 @@
|
||||
});
|
||||
}
|
||||
|
||||
function importSafeInCloud(file, success, error) {
|
||||
Papa.parse(file, {
|
||||
header: true,
|
||||
complete: function (results) {
|
||||
var folders = [],
|
||||
sites = [],
|
||||
siteRelationships = [];
|
||||
|
||||
angular.forEach(results.data, function (value, key) {
|
||||
sites.push({
|
||||
favorite: false,
|
||||
uri: value.URL && value.URL !== '' ? value.URL : null,
|
||||
username: value.Login && value.Login !== '' ? value.Login : null,
|
||||
password: value.Password,
|
||||
notes: value.Notes && value.Notes !== '' ? value.Notes : null,
|
||||
name: value.Title
|
||||
});
|
||||
});
|
||||
|
||||
success(folders, sites, siteRelationships);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return _service;
|
||||
});
|
||||
|
@ -9,6 +9,7 @@
|
||||
<select id="source" name="source" class="form-control" ng-model="model.source">
|
||||
<option value="local">bitwarden</option>
|
||||
<option value="lastpass">LastPass</option>
|
||||
<option value="safeincloud">SafeInCloud</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
Loading…
Reference in New Issue
Block a user