]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/+signup/+register/register-step-terms.component.ts
Implemented configurable minimum signup age
[github/Chocobozzz/PeerTube.git] / client / src / app / +signup / +register / register-step-terms.component.ts
1 import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'
2 import { FormGroup } from '@angular/forms'
3 import {
4 USER_TERMS_VALIDATOR
5 } from '@app/shared/form-validators/user-validators'
6 import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
7
8 @Component({
9 selector: 'my-register-step-terms',
10 templateUrl: './register-step-terms.component.html',
11 styleUrls: [ './register.component.scss' ]
12 })
13 export class RegisterStepTermsComponent extends FormReactive implements OnInit {
14 @Input() hasCodeOfConduct = false
15 @Input() minimumAge = 16
16
17 @Output() formBuilt = new EventEmitter<FormGroup>()
18 @Output() termsClick = new EventEmitter<void>()
19 @Output() codeOfConductClick = new EventEmitter<void>()
20
21 constructor (
22 protected formValidatorService: FormValidatorService
23 ) {
24 super()
25 }
26
27 get instanceHost () {
28 return window.location.host
29 }
30
31 ngOnInit () {
32 this.buildForm({
33 terms: USER_TERMS_VALIDATOR
34 })
35
36 setTimeout(() => this.formBuilt.emit(this.form))
37 }
38
39 onTermsClick (event: Event) {
40 event.preventDefault()
41 this.termsClick.emit()
42 }
43
44 onCodeOfConductClick (event: Event) {
45 event.preventDefault()
46 this.codeOfConductClick.emit()
47 }
48 }