mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-24 12:06:15 +01:00
name from url
This commit is contained in:
parent
1aa774b99f
commit
0d2cd4c482
@ -20,7 +20,8 @@ export class AviraCsvImporter extends BaseImporter implements Importer {
|
|||||||
results.forEach((value) => {
|
results.forEach((value) => {
|
||||||
const cipher = new CipherView();
|
const cipher = new CipherView();
|
||||||
cipher.type = CipherType.Login;
|
cipher.type = CipherType.Login;
|
||||||
cipher.name = this.getValueOrDefault(value.name, '--');
|
cipher.name = this.getValueOrDefault(value.name,
|
||||||
|
this.getValueOrDefault(this.nameFromUrl(value.website), '--'));
|
||||||
cipher.login = new LoginView();
|
cipher.login = new LoginView();
|
||||||
cipher.login.uris = this.makeUriArray(value.website);
|
cipher.login.uris = this.makeUriArray(value.website);
|
||||||
cipher.login.password = this.getValueOrDefault(value.password);
|
cipher.login.password = this.getValueOrDefault(value.password);
|
||||||
|
@ -2,6 +2,8 @@ import * as papa from 'papaparse';
|
|||||||
|
|
||||||
import { LoginUriView } from '../models/view/loginUriView';
|
import { LoginUriView } from '../models/view/loginUriView';
|
||||||
|
|
||||||
|
import { Utils } from '../misc/utils';
|
||||||
|
|
||||||
export abstract class BaseImporter {
|
export abstract class BaseImporter {
|
||||||
protected passwordFieldNames = [
|
protected passwordFieldNames = [
|
||||||
'password', 'pass word', 'passphrase', 'pass phrase',
|
'password', 'pass word', 'passphrase', 'pass phrase',
|
||||||
@ -112,6 +114,14 @@ export abstract class BaseImporter {
|
|||||||
return uri;
|
return uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected nameFromUrl(url: string) {
|
||||||
|
const hostname = Utils.getHostname(url);
|
||||||
|
if (this.isNullOrWhitespace(hostname)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return hostname.startsWith('www.') ? hostname.replace('www.', '') : hostname;
|
||||||
|
}
|
||||||
|
|
||||||
protected isNullOrWhitespace(str: string): boolean {
|
protected isNullOrWhitespace(str: string): boolean {
|
||||||
return str == null || str.trim() === '';
|
return str == null || str.trim() === '';
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user