diff options
author | Poslovitch <poslovitch@bentobox.world> | 2021-04-24 09:57:01 +0000 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-05-28 13:56:05 +0200 |
commit | 1f256e7d3cf056c2d999260155cdba58ae1b878b (patch) | |
tree | e33db698da50c329e1eea4122e190e6ef247d8e4 /client/src/app/+signup | |
parent | f22e0e2c19b06edfc85429198f9e54a075f71ad3 (diff) | |
download | PeerTube-1f256e7d3cf056c2d999260155cdba58ae1b878b.tar.gz PeerTube-1f256e7d3cf056c2d999260155cdba58ae1b878b.tar.zst PeerTube-1f256e7d3cf056c2d999260155cdba58ae1b878b.zip |
Implemented configurable minimum signup age
Implements https://github.com/Chocobozzz/PeerTube/issues/3612
Fixed lint and removed debug
Fixed another lint error
Apply suggestions from code review
Co-authored-by: Chocobozzz <chocobozzz@cpy.re>
Add tests for min signup age config
Diffstat (limited to 'client/src/app/+signup')
4 files changed, 8 insertions, 2 deletions
diff --git a/client/src/app/+signup/+register/register-step-terms.component.html b/client/src/app/+signup/+register/register-step-terms.component.html index 1cfdc0a3a..28a6e0021 100644 --- a/client/src/app/+signup/+register/register-step-terms.component.html +++ b/client/src/app/+signup/+register/register-step-terms.component.html | |||
@@ -2,8 +2,8 @@ | |||
2 | <div class="form-group form-group-terms"> | 2 | <div class="form-group form-group-terms"> |
3 | <my-peertube-checkbox inputName="terms" formControlName="terms"> | 3 | <my-peertube-checkbox inputName="terms" formControlName="terms"> |
4 | <ng-template ptTemplate="label"> | 4 | <ng-template ptTemplate="label"> |
5 | <ng-container i18n> | 5 | <ng-container i18n> |
6 | I am at least 16 years old and agree | 6 | I am at least {{ minimumAge }} years old and agree |
7 | to the <a class="terms-anchor" (click)="onTermsClick($event)" href='#'>Terms</a> | 7 | to the <a class="terms-anchor" (click)="onTermsClick($event)" href='#'>Terms</a> |
8 | <ng-container *ngIf="hasCodeOfConduct"> and to the <a (click)="onCodeOfConductClick($event)" href='#'>Code of Conduct</a></ng-container> | 8 | <ng-container *ngIf="hasCodeOfConduct"> and to the <a (click)="onCodeOfConductClick($event)" href='#'>Code of Conduct</a></ng-container> |
9 | of this instance | 9 | of this instance |
diff --git a/client/src/app/+signup/+register/register-step-terms.component.ts b/client/src/app/+signup/+register/register-step-terms.component.ts index db834c68d..20c1ae1c4 100644 --- a/client/src/app/+signup/+register/register-step-terms.component.ts +++ b/client/src/app/+signup/+register/register-step-terms.component.ts | |||
@@ -12,6 +12,7 @@ import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' | |||
12 | }) | 12 | }) |
13 | export class RegisterStepTermsComponent extends FormReactive implements OnInit { | 13 | export class RegisterStepTermsComponent extends FormReactive implements OnInit { |
14 | @Input() hasCodeOfConduct = false | 14 | @Input() hasCodeOfConduct = false |
15 | @Input() minimumAge = 16 | ||
15 | 16 | ||
16 | @Output() formBuilt = new EventEmitter<FormGroup>() | 17 | @Output() formBuilt = new EventEmitter<FormGroup>() |
17 | @Output() termsClick = new EventEmitter<void>() | 18 | @Output() termsClick = new EventEmitter<void>() |
diff --git a/client/src/app/+signup/+register/register.component.html b/client/src/app/+signup/+register/register.component.html index dc1c7496f..de72065d3 100644 --- a/client/src/app/+signup/+register/register.component.html +++ b/client/src/app/+signup/+register/register.component.html | |||
@@ -17,6 +17,7 @@ | |||
17 | 17 | ||
18 | <my-register-step-terms | 18 | <my-register-step-terms |
19 | [hasCodeOfConduct]="!!aboutHtml.codeOfConduct" | 19 | [hasCodeOfConduct]="!!aboutHtml.codeOfConduct" |
20 | [minimumAge]="minimumAge" | ||
20 | (formBuilt)="onTermsFormBuilt($event)" (termsClick)="onTermsClick()" (codeOfConductClick)="onCodeOfConductClick()" | 21 | (formBuilt)="onTermsFormBuilt($event)" (termsClick)="onTermsClick()" (codeOfConductClick)="onCodeOfConductClick()" |
21 | ></my-register-step-terms> | 22 | ></my-register-step-terms> |
22 | 23 | ||
diff --git a/client/src/app/+signup/+register/register.component.ts b/client/src/app/+signup/+register/register.component.ts index 8e89bb01a..241ca04c6 100644 --- a/client/src/app/+signup/+register/register.component.ts +++ b/client/src/app/+signup/+register/register.component.ts | |||
@@ -56,6 +56,10 @@ export class RegisterComponent implements OnInit { | |||
56 | return this.serverConfig.signup.requiresEmailVerification | 56 | return this.serverConfig.signup.requiresEmailVerification |
57 | } | 57 | } |
58 | 58 | ||
59 | get minimumAge () { | ||
60 | return this.serverConfig.signup.minimumAge | ||
61 | } | ||
62 | |||
59 | ngOnInit (): void { | 63 | ngOnInit (): void { |
60 | this.serverConfig = this.route.snapshot.data.serverConfig | 64 | this.serverConfig = this.route.snapshot.data.serverConfig |
61 | 65 | ||