null checks and fix email in notes
This commit is contained in:
parent
30a5257671
commit
e0c32bebc7
|
@ -13,32 +13,32 @@ export class PassmanJsonImporter extends BaseImporter implements Importer {
|
||||||
}
|
}
|
||||||
|
|
||||||
results.forEach((credential: any) => {
|
results.forEach((credential: any) => {
|
||||||
if (credential.tags.length > 0) {
|
if (credential.tags != null && credential.tags.length > 0) {
|
||||||
const folderName = credential.tags[0].text;
|
const folderName = credential.tags[0].text;
|
||||||
this.processFolder(result, folderName);
|
this.processFolder(result, folderName);
|
||||||
}
|
}
|
||||||
|
|
||||||
const cipher = this.initLoginCipher();
|
const cipher = this.initLoginCipher();
|
||||||
cipher.name = credential.label;
|
cipher.name = credential.label;
|
||||||
if (cipher.name.length > 30) {
|
if (cipher.name != null && cipher.name.length > 30) {
|
||||||
cipher.name = cipher.name.substring(0, 30);
|
cipher.name = cipher.name.substring(0, 30);
|
||||||
}
|
}
|
||||||
|
|
||||||
cipher.login.username = this.getValueOrDefault(credential.username);
|
cipher.login.username = this.getValueOrDefault(credential.username);
|
||||||
if (cipher.login.username === null) {
|
if (this.isNullOrWhitespace(cipher.login.username)) {
|
||||||
cipher.login.username = this.getValueOrDefault(credential.email);
|
cipher.login.username = this.getValueOrDefault(credential.email);
|
||||||
} else if (credential.email !== '') {
|
} else if (!this.isNullOrWhitespace(credential.email)) {
|
||||||
cipher.notes += 'E-Mail: ' + credential.email;
|
cipher.notes = ('Email: ' + credential.email + '\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
cipher.login.password = this.getValueOrDefault(credential.password);
|
cipher.login.password = this.getValueOrDefault(credential.password);
|
||||||
cipher.login.uris = this.makeUriArray(credential.url);
|
cipher.login.uris = this.makeUriArray(credential.url);
|
||||||
cipher.notes = this.getValueOrDefault(credential.description);
|
cipher.notes += this.getValueOrDefault(credential.description);
|
||||||
|
if (credential.otp != null) {
|
||||||
if (credential.otp) {
|
cipher.login.totp = this.getValueOrDefault(credential.otp.secret);
|
||||||
cipher.login.totp = credential.otp.secret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (credential.custom_fields != null) {
|
||||||
credential.custom_fields.forEach((customField: any) => {
|
credential.custom_fields.forEach((customField: any) => {
|
||||||
switch (customField.field_type) {
|
switch (customField.field_type) {
|
||||||
case 'text':
|
case 'text':
|
||||||
|
@ -47,6 +47,7 @@ export class PassmanJsonImporter extends BaseImporter implements Importer {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
this.convertToNoteIfNeeded(cipher);
|
this.convertToNoteIfNeeded(cipher);
|
||||||
this.cleanupCipher(cipher);
|
this.cleanupCipher(cipher);
|
||||||
|
|
Loading…
Reference in New Issue