From 5e50aa1a195bde11fdc14e9bdf71542766fdbb8d Mon Sep 17 00:00:00 2001 From: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Date: Mon, 2 Nov 2020 12:50:58 -0600 Subject: [PATCH] Added terms/privacy variables & logic (#193) --- src/angular/components/register.component.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/angular/components/register.component.ts b/src/angular/components/register.component.ts index 062b1fa0f2..a0f49cf5f1 100644 --- a/src/angular/components/register.component.ts +++ b/src/angular/components/register.component.ts @@ -24,6 +24,8 @@ export class RegisterComponent { formPromise: Promise; masterPasswordScore: number; referenceData: ReferenceEventRequest; + showTerms = true; + acceptPolicies: boolean = false; protected successRoute = 'login'; private masterPasswordStrengthTimeout: any; @@ -32,7 +34,9 @@ export class RegisterComponent { protected i18nService: I18nService, protected cryptoService: CryptoService, protected apiService: ApiService, protected stateService: StateService, protected platformUtilsService: PlatformUtilsService, - protected passwordGenerationService: PasswordGenerationService) { } + protected passwordGenerationService: PasswordGenerationService) { + this.showTerms = !platformUtilsService.isSelfHost(); + } get masterPasswordScoreWidth() { return this.masterPasswordScore == null ? 0 : (this.masterPasswordScore + 1) * 20; @@ -65,6 +69,12 @@ export class RegisterComponent { } async submit() { + if (!this.acceptPolicies && this.showTerms) { + this.platformUtilsService.showToast('error', this.i18nService.t('errorOccurred'), + this.i18nService.t('acceptPoliciesError')); + return; + } + if (this.email == null || this.email === '') { this.platformUtilsService.showToast('error', this.i18nService.t('errorOccurred'), this.i18nService.t('emailRequired'));