Add validation for vcard.

This commit is contained in:
Spencer Ofwiti
2021-04-27 17:10:50 +03:00
parent 63f0fe3070
commit cb14b9b5dc
3 changed files with 7 additions and 5 deletions

View File

@@ -12,7 +12,7 @@ import {MutableKeyStore, PGPSigner, Signer} from '@app/_pgp';
import {RegistryService} from '@app/_services/registry.service';
import {CICRegistry} from 'cic-client';
import {AuthService} from './auth.service';
import {personValidation} from '@app/_helpers';
import {personValidation, vcardValidation} from '@app/_helpers';
const vCard = require('vcard-parser');
@Injectable({
@@ -88,6 +88,7 @@ export class UserService {
accountInfo.location.area = location;
accountInfo.location.area_name = userLocation;
accountInfo.location.area_type = locationType;
await vcardValidation(accountInfo.vcard);
accountInfo.vcard = btoa(vCard.generate(accountInfo.vcard));
await personValidation(accountInfo);
const accountKey = await User.toKey(address);
@@ -188,6 +189,7 @@ export class UserService {
await personValidation(accountInfo);
accountInfo.balance = await this.tokenService.getTokenBalance(accountInfo.identities.evm['bloxberg:8996'][0]);
accountInfo.vcard = vCard.parse(atob(accountInfo.vcard));
await vcardValidation(accountInfo.vcard);
this.accounts.unshift(accountInfo);
if (this.accounts.length > limit) {
this.accounts.length = limit;