From 9ca79c49294ecbea10f68220d0da87dd9bf15f3f Mon Sep 17 00:00:00 2001 From: Chad Scharf <3904944+cscharf@users.noreply.github.com> Date: Fri, 17 Jul 2020 16:05:58 -0400 Subject: [PATCH 1/3] Reference id to data conversion --- src/angular/components/register.component.ts | 5 +++-- src/models/domain/referenceEventData.ts | 5 +++++ src/models/request/registerRequest.ts | 7 ++++--- 3 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 src/models/domain/referenceEventData.ts diff --git a/src/angular/components/register.component.ts b/src/angular/components/register.component.ts index b3ad95d377..29a9ee04ed 100644 --- a/src/angular/components/register.component.ts +++ b/src/angular/components/register.component.ts @@ -12,6 +12,7 @@ import { PlatformUtilsService } from '../../abstractions/platformUtils.service'; import { StateService } from '../../abstractions/state.service'; import { KdfType } from '../../enums/kdfType'; +import { ReferenceEventData } from '../../models/domain/referenceEventData'; export class RegisterComponent { name: string = ''; @@ -22,7 +23,7 @@ export class RegisterComponent { showPassword: boolean = false; formPromise: Promise; masterPasswordScore: number; - referenceId: string; + referenceData: ReferenceEventData; protected successRoute = 'login'; private masterPasswordStrengthTimeout: any; @@ -111,7 +112,7 @@ export class RegisterComponent { const hashedPassword = await this.cryptoService.hashPassword(this.masterPassword, key); const keys = await this.cryptoService.makeKeyPair(encKey[0]); 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); const orgInvite = await this.stateService.get('orgInvitation'); if (orgInvite != null && orgInvite.token != null && orgInvite.organizationUserId != null) { diff --git a/src/models/domain/referenceEventData.ts b/src/models/domain/referenceEventData.ts new file mode 100644 index 0000000000..78ffcbfaf5 --- /dev/null +++ b/src/models/domain/referenceEventData.ts @@ -0,0 +1,5 @@ +export class ReferenceEventData { + id: string; + layout: string; + flow: string; +} diff --git a/src/models/request/registerRequest.ts b/src/models/request/registerRequest.ts index f96544e80e..ebe998435a 100644 --- a/src/models/request/registerRequest.ts +++ b/src/models/request/registerRequest.ts @@ -1,6 +1,7 @@ import { KeysRequest } from './keysRequest'; import { KdfType } from '../../enums/kdfType'; +import { ReferenceEventData } from '../domain/referenceEventData'; export class RegisterRequest { name: string; @@ -13,10 +14,10 @@ export class RegisterRequest { organizationUserId: string; kdf: KdfType; kdfIterations: number; - referenceId: string; + referenceData: ReferenceEventData; 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.email = email; this.masterPasswordHash = masterPasswordHash; @@ -24,6 +25,6 @@ export class RegisterRequest { this.key = key; this.kdf = kdf; this.kdfIterations = kdfIterations; - this.referenceId = referenceId; + this.referenceData = referenceData; } } From 97d24f5abffccd657655c17da05ca932649c9d13 Mon Sep 17 00:00:00 2001 From: Chad Scharf <3904944+cscharf@users.noreply.github.com> Date: Mon, 20 Jul 2020 15:21:01 -0400 Subject: [PATCH 2/3] reference event data model changes --- src/angular/components/register.component.ts | 4 ++-- .../referenceEventRequest.ts} | 2 +- src/models/request/registerRequest.ts | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) rename src/models/{domain/referenceEventData.ts => request/referenceEventRequest.ts} (60%) diff --git a/src/angular/components/register.component.ts b/src/angular/components/register.component.ts index 29a9ee04ed..0ba73829d2 100644 --- a/src/angular/components/register.component.ts +++ b/src/angular/components/register.component.ts @@ -12,7 +12,7 @@ import { PlatformUtilsService } from '../../abstractions/platformUtils.service'; import { StateService } from '../../abstractions/state.service'; import { KdfType } from '../../enums/kdfType'; -import { ReferenceEventData } from '../../models/domain/referenceEventData'; +import { ReferenceEventRequest } from '../../models/request/referenceEventRequest'; export class RegisterComponent { name: string = ''; @@ -23,7 +23,7 @@ export class RegisterComponent { showPassword: boolean = false; formPromise: Promise; masterPasswordScore: number; - referenceData: ReferenceEventData; + referenceData: ReferenceEventRequest; protected successRoute = 'login'; private masterPasswordStrengthTimeout: any; diff --git a/src/models/domain/referenceEventData.ts b/src/models/request/referenceEventRequest.ts similarity index 60% rename from src/models/domain/referenceEventData.ts rename to src/models/request/referenceEventRequest.ts index 78ffcbfaf5..4cd8c507f6 100644 --- a/src/models/domain/referenceEventData.ts +++ b/src/models/request/referenceEventRequest.ts @@ -1,4 +1,4 @@ -export class ReferenceEventData { +export class ReferenceEventRequest { id: string; layout: string; flow: string; diff --git a/src/models/request/registerRequest.ts b/src/models/request/registerRequest.ts index ebe998435a..a93ac69bba 100644 --- a/src/models/request/registerRequest.ts +++ b/src/models/request/registerRequest.ts @@ -1,7 +1,7 @@ import { KeysRequest } from './keysRequest'; +import { ReferenceEventRequest } from './referenceEventRequest'; import { KdfType } from '../../enums/kdfType'; -import { ReferenceEventData } from '../domain/referenceEventData'; export class RegisterRequest { name: string; @@ -14,10 +14,10 @@ export class RegisterRequest { organizationUserId: string; kdf: KdfType; kdfIterations: number; - referenceData: ReferenceEventData; + referenceData: ReferenceEventRequest; constructor(email: string, name: string, masterPasswordHash: string, masterPasswordHint: string, key: string, - kdf: KdfType, kdfIterations: number, referenceData: ReferenceEventData) { + kdf: KdfType, kdfIterations: number, referenceData: ReferenceEventRequest) { this.name = name; this.email = email; this.masterPasswordHash = masterPasswordHash; From 6e79dfa01a785fb239c7f0026dcd427db981eb55 Mon Sep 17 00:00:00 2001 From: Chad Scharf <3904944+cscharf@users.noreply.github.com> Date: Mon, 20 Jul 2020 15:38:56 -0400 Subject: [PATCH 3/3] fixed import groupings/order --- src/angular/components/register.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/angular/components/register.component.ts b/src/angular/components/register.component.ts index 0ba73829d2..b3f689fcd0 100644 --- a/src/angular/components/register.component.ts +++ b/src/angular/components/register.component.ts @@ -1,6 +1,7 @@ import { Router } from '@angular/router'; import { KeysRequest } from '../../models/request/keysRequest'; +import { ReferenceEventRequest } from '../../models/request/referenceEventRequest'; import { RegisterRequest } from '../../models/request/registerRequest'; import { ApiService } from '../../abstractions/api.service'; @@ -12,7 +13,6 @@ import { PlatformUtilsService } from '../../abstractions/platformUtils.service'; import { StateService } from '../../abstractions/state.service'; import { KdfType } from '../../enums/kdfType'; -import { ReferenceEventRequest } from '../../models/request/referenceEventRequest'; export class RegisterComponent { name: string = '';