From 9bc7459eacb55a234da8dd8aa71c059a4cd3e1ee Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Fri, 13 Jul 2018 11:06:44 -0400 Subject: [PATCH] add org invite token to registration if present --- src/angular/components/register.component.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/angular/components/register.component.ts b/src/angular/components/register.component.ts index 1650afd116..77f9959243 100644 --- a/src/angular/components/register.component.ts +++ b/src/angular/components/register.component.ts @@ -10,6 +10,7 @@ import { ApiService } from '../../abstractions/api.service'; import { AuthService } from '../../abstractions/auth.service'; import { CryptoService } from '../../abstractions/crypto.service'; import { I18nService } from '../../abstractions/i18n.service'; +import { StateService } from '../../abstractions/state.service'; export class RegisterComponent { name: string = ''; @@ -25,7 +26,7 @@ export class RegisterComponent { constructor(protected authService: AuthService, protected router: Router, protected analytics: Angulartics2, protected toasterService: ToasterService, protected i18nService: I18nService, protected cryptoService: CryptoService, - protected apiService: ApiService) { } + protected apiService: ApiService, protected stateService: StateService) { } async submit() { if (this.email == null || this.email === '') { @@ -63,6 +64,11 @@ export class RegisterComponent { const request = new RegisterRequest(this.email, this.name, hashedPassword, this.hint, encKey[1].encryptedString); 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) { + request.token = orgInvite.token; + request.organizationUserId = orgInvite.organizationUserId; + } try { this.formPromise = this.apiService.postRegister(request);