Skip to content
This repository has been archived by the owner on Jun 17, 2022. It is now read-only.

Commit

Permalink
Added terms/privacy variables & logic (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentsalucci committed Nov 2, 2020
1 parent 8cb5a9f commit 5e50aa1
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/angular/components/register.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export class RegisterComponent {
formPromise: Promise<any>;
masterPasswordScore: number;
referenceData: ReferenceEventRequest;
showTerms = true;
acceptPolicies: boolean = false;

protected successRoute = 'login';
private masterPasswordStrengthTimeout: any;
Expand All @@ -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;
Expand Down Expand Up @@ -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'));
Expand Down

0 comments on commit 5e50aa1

Please sign in to comment.