Reference id to data conversion

This commit is contained in:
Chad Scharf 2020-07-17 16:05:58 -04:00
parent 7fa5178bff
commit 9ca79c4929
3 changed files with 12 additions and 5 deletions

View File

@ -12,6 +12,7 @@ import { PlatformUtilsService } from '../../abstractions/platformUtils.service';
import { StateService } from '../../abstractions/state.service'; import { StateService } from '../../abstractions/state.service';
import { KdfType } from '../../enums/kdfType'; import { KdfType } from '../../enums/kdfType';
import { ReferenceEventData } from '../../models/domain/referenceEventData';
export class RegisterComponent { export class RegisterComponent {
name: string = ''; name: string = '';
@ -22,7 +23,7 @@ export class RegisterComponent {
showPassword: boolean = false; showPassword: boolean = false;
formPromise: Promise<any>; formPromise: Promise<any>;
masterPasswordScore: number; masterPasswordScore: number;
referenceId: string; referenceData: ReferenceEventData;
protected successRoute = 'login'; protected successRoute = 'login';
private masterPasswordStrengthTimeout: any; private masterPasswordStrengthTimeout: any;
@ -111,7 +112,7 @@ export class RegisterComponent {
const hashedPassword = await this.cryptoService.hashPassword(this.masterPassword, key); const hashedPassword = await this.cryptoService.hashPassword(this.masterPassword, key);
const keys = await this.cryptoService.makeKeyPair(encKey[0]); const keys = await this.cryptoService.makeKeyPair(encKey[0]);
const request = new RegisterRequest(this.email, this.name, hashedPassword, const request = new RegisterRequest(this.email, this.name, hashedPassword,
this.hint, encKey[1].encryptedString, kdf, kdfIterations, this.referenceId); this.hint, encKey[1].encryptedString, kdf, kdfIterations, this.referenceData);
request.keys = new KeysRequest(keys[0], keys[1].encryptedString); request.keys = new KeysRequest(keys[0], keys[1].encryptedString);
const orgInvite = await this.stateService.get<any>('orgInvitation'); const orgInvite = await this.stateService.get<any>('orgInvitation');
if (orgInvite != null && orgInvite.token != null && orgInvite.organizationUserId != null) { if (orgInvite != null && orgInvite.token != null && orgInvite.organizationUserId != null) {

View File

@ -0,0 +1,5 @@
export class ReferenceEventData {
id: string;
layout: string;
flow: string;
}

View File

@ -1,6 +1,7 @@
import { KeysRequest } from './keysRequest'; import { KeysRequest } from './keysRequest';
import { KdfType } from '../../enums/kdfType'; import { KdfType } from '../../enums/kdfType';
import { ReferenceEventData } from '../domain/referenceEventData';
export class RegisterRequest { export class RegisterRequest {
name: string; name: string;
@ -13,10 +14,10 @@ export class RegisterRequest {
organizationUserId: string; organizationUserId: string;
kdf: KdfType; kdf: KdfType;
kdfIterations: number; kdfIterations: number;
referenceId: string; referenceData: ReferenceEventData;
constructor(email: string, name: string, masterPasswordHash: string, masterPasswordHint: string, key: string, constructor(email: string, name: string, masterPasswordHash: string, masterPasswordHint: string, key: string,
kdf: KdfType, kdfIterations: number, referenceId: string) { kdf: KdfType, kdfIterations: number, referenceData: ReferenceEventData) {
this.name = name; this.name = name;
this.email = email; this.email = email;
this.masterPasswordHash = masterPasswordHash; this.masterPasswordHash = masterPasswordHash;
@ -24,6 +25,6 @@ export class RegisterRequest {
this.key = key; this.key = key;
this.kdf = kdf; this.kdf = kdf;
this.kdfIterations = kdfIterations; this.kdfIterations = kdfIterations;
this.referenceId = referenceId; this.referenceData = referenceData;
} }
} }