aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/signup/signup.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/signup/signup.component.ts')
-rw-r--r--client/src/app/signup/signup.component.ts32
1 files changed, 7 insertions, 25 deletions
diff --git a/client/src/app/signup/signup.component.ts b/client/src/app/signup/signup.component.ts
index eaed2626d..682e592c7 100644
--- a/client/src/app/signup/signup.component.ts
+++ b/client/src/app/signup/signup.component.ts
@@ -1,5 +1,4 @@
1import { Component, OnInit } from '@angular/core' 1import { Component, OnInit } from '@angular/core'
2import { FormBuilder, FormGroup } from '@angular/forms'
3import { Router } from '@angular/router' 2import { Router } from '@angular/router'
4import { ServerService } from '@app/core/server' 3import { ServerService } from '@app/core/server'
5 4
@@ -8,6 +7,7 @@ import { UserCreate } from '../../../../shared'
8import { FormReactive, USER_EMAIL, USER_PASSWORD, USER_USERNAME, UserService } from '../shared' 7import { FormReactive, USER_EMAIL, USER_PASSWORD, USER_USERNAME, UserService } from '../shared'
9import { RedirectService } from '@app/core' 8import { RedirectService } from '@app/core'
10import { I18n } from '@ngx-translate/i18n-polyfill' 9import { I18n } from '@ngx-translate/i18n-polyfill'
10import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service'
11 11
12@Component({ 12@Component({
13 selector: 'my-signup', 13 selector: 'my-signup',
@@ -18,18 +18,6 @@ export class SignupComponent extends FormReactive implements OnInit {
18 error: string = null 18 error: string = null
19 quotaHelpIndication = '' 19 quotaHelpIndication = ''
20 20
21 form: FormGroup
22 formErrors = {
23 'username': '',
24 'email': '',
25 'password': ''
26 }
27 validationMessages = {
28 'username': USER_USERNAME.MESSAGES,
29 'email': USER_EMAIL.MESSAGES,
30 'password': USER_PASSWORD.MESSAGES
31 }
32
33 private static getApproximateTime (seconds: number) { 21 private static getApproximateTime (seconds: number) {
34 const hours = Math.floor(seconds / 3600) 22 const hours = Math.floor(seconds / 3600)
35 let pluralSuffix = '' 23 let pluralSuffix = ''
@@ -43,7 +31,7 @@ export class SignupComponent extends FormReactive implements OnInit {
43 } 31 }
44 32
45 constructor ( 33 constructor (
46 private formBuilder: FormBuilder, 34 protected formValidatorService: FormValidatorService,
47 private router: Router, 35 private router: Router,
48 private notificationsService: NotificationsService, 36 private notificationsService: NotificationsService,
49 private userService: UserService, 37 private userService: UserService,
@@ -58,18 +46,12 @@ export class SignupComponent extends FormReactive implements OnInit {
58 return this.serverService.getConfig().user.videoQuota 46 return this.serverService.getConfig().user.videoQuota
59 } 47 }
60 48
61 buildForm () {
62 this.form = this.formBuilder.group({
63 username: [ '', USER_USERNAME.VALIDATORS ],
64 email: [ '', USER_EMAIL.VALIDATORS ],
65 password: [ '', USER_PASSWORD.VALIDATORS ]
66 })
67
68 this.form.valueChanges.subscribe(data => this.onValueChanged(data))
69 }
70
71 ngOnInit () { 49 ngOnInit () {
72 this.buildForm() 50 this.buildForm({
51 username: USER_USERNAME,
52 password: USER_PASSWORD,
53 email: USER_EMAIL
54 })
73 55
74 this.serverService.configLoaded 56 this.serverService.configLoaded
75 .subscribe(() => this.buildQuotaHelpIndication()) 57 .subscribe(() => this.buildQuotaHelpIndication())