Added importer for universal password manager csv format

This commit is contained in:
Kyle Spearrin 2016-11-09 18:18:46 -05:00
parent b5b706fe06
commit 9405be03b0
2 changed files with 32 additions and 0 deletions

View File

@ -38,6 +38,9 @@
case 'firefoxpasswordexportercsvxml': case 'firefoxpasswordexportercsvxml':
importFirefoxPasswordExporterCsvXml(file, success, error); importFirefoxPasswordExporterCsvXml(file, success, error);
break; break;
case 'upmcsv':
importUpmCsv(file, success, error);
break;
default: default:
error(); error();
break; break;
@ -749,5 +752,33 @@
} }
} }
function importUpmCsv(file, success, error) {
Papa.parse(file, {
encoding: 'UTF-8',
complete: function (results) {
parseCsvErrors(results);
var folders = [],
sites = [],
siteRelationships = [];
angular.forEach(results.data, function (value, key) {
if (value.length === 5) {
sites.push({
favorite: false,
uri: value[3] && value[3] !== '' ? trimUri(value[3]) : null,
username: value[1] && value[1] !== '' ? value[1] : null,
password: value[2] && value[2] !== '' ? value[2] : null,
notes: value[4] && value[4] !== '' ? value[4] : null,
name: value[0] && value[0] !== '' ? value[0] : '--',
});
}
});
success(folders, sites, siteRelationships);
}
});
}
return _service; return _service;
}); });

View File

@ -16,6 +16,7 @@
<option value="keypassxml">KeyPass (xml)</option> <option value="keypassxml">KeyPass (xml)</option>
<option value="padlockcsv">Padlock (csv)</option> <option value="padlockcsv">Padlock (csv)</option>
<option value="1password1pif">1Password (1pif)</option> <option value="1password1pif">1Password (1pif)</option>
<option value="upmcsv">Universal Password Manager (csv)</option>
</select> </select>
</div> </div>
<div class="form-group"> <div class="form-group">