aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/signup
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/signup')
-rw-r--r--client/src/app/signup/index.ts6
-rw-r--r--client/src/app/signup/signup-routing.module.ts8
-rw-r--r--client/src/app/signup/signup.component.ts50
-rw-r--r--client/src/app/signup/signup.module.ts8
4 files changed, 36 insertions, 36 deletions
diff --git a/client/src/app/signup/index.ts b/client/src/app/signup/index.ts
index 1f4290ab5..b0aca9723 100644
--- a/client/src/app/signup/index.ts
+++ b/client/src/app/signup/index.ts
@@ -1,3 +1,3 @@
1export * from './signup-routing.module'; 1export * from './signup-routing.module'
2export * from './signup.component'; 2export * from './signup.component'
3export * from './signup.module'; 3export * from './signup.module'
diff --git a/client/src/app/signup/signup-routing.module.ts b/client/src/app/signup/signup-routing.module.ts
index 367eed90c..122d6c976 100644
--- a/client/src/app/signup/signup-routing.module.ts
+++ b/client/src/app/signup/signup-routing.module.ts
@@ -1,7 +1,7 @@
1import { NgModule } from '@angular/core'; 1import { NgModule } from '@angular/core'
2import { RouterModule, Routes } from '@angular/router'; 2import { RouterModule, Routes } from '@angular/router'
3 3
4import { SignupComponent } from './signup.component'; 4import { SignupComponent } from './signup.component'
5 5
6const signupRoutes: Routes = [ 6const signupRoutes: Routes = [
7 { 7 {
@@ -13,7 +13,7 @@ const signupRoutes: Routes = [
13 } 13 }
14 } 14 }
15 } 15 }
16]; 16]
17 17
18@NgModule({ 18@NgModule({
19 imports: [ RouterModule.forChild(signupRoutes) ], 19 imports: [ RouterModule.forChild(signupRoutes) ],
diff --git a/client/src/app/signup/signup.component.ts b/client/src/app/signup/signup.component.ts
index 85f93793b..bcbc8ded3 100644
--- a/client/src/app/signup/signup.component.ts
+++ b/client/src/app/signup/signup.component.ts
@@ -1,72 +1,72 @@
1import { Component, OnInit } from '@angular/core'; 1import { Component, OnInit } from '@angular/core'
2import { FormBuilder, FormGroup, Validators } from '@angular/forms'; 2import { FormBuilder, FormGroup, Validators } from '@angular/forms'
3import { Router } from '@angular/router'; 3import { Router } from '@angular/router'
4 4
5import { NotificationsService } from 'angular2-notifications'; 5import { NotificationsService } from 'angular2-notifications'
6 6
7import { AuthService } from '../core'; 7import { AuthService } from '../core'
8import { 8import {
9 FormReactive, 9 FormReactive,
10 UserService, 10 UserService,
11 USER_USERNAME, 11 USER_USERNAME,
12 USER_EMAIL, 12 USER_EMAIL,
13 USER_PASSWORD 13 USER_PASSWORD
14} from '../shared'; 14} from '../shared'
15 15
16@Component({ 16@Component({
17 selector: 'my-signup', 17 selector: 'my-signup',
18 templateUrl: './signup.component.html' 18 templateUrl: './signup.component.html'
19}) 19})
20export class SignupComponent extends FormReactive implements OnInit { 20export class SignupComponent extends FormReactive implements OnInit {
21 error: string = null; 21 error: string = null
22 22
23 form: FormGroup; 23 form: FormGroup
24 formErrors = { 24 formErrors = {
25 'username': '', 25 'username': '',
26 'email': '', 26 'email': '',
27 'password': '' 27 'password': ''
28 }; 28 }
29 validationMessages = { 29 validationMessages = {
30 'username': USER_USERNAME.MESSAGES, 30 'username': USER_USERNAME.MESSAGES,
31 'email': USER_EMAIL.MESSAGES, 31 'email': USER_EMAIL.MESSAGES,
32 'password': USER_PASSWORD.MESSAGES, 32 'password': USER_PASSWORD.MESSAGES
33 }; 33 }
34 34
35 constructor( 35 constructor (
36 private formBuilder: FormBuilder, 36 private formBuilder: FormBuilder,
37 private router: Router, 37 private router: Router,
38 private notificationsService: NotificationsService, 38 private notificationsService: NotificationsService,
39 private userService: UserService 39 private userService: UserService
40 ) { 40 ) {
41 super(); 41 super()
42 } 42 }
43 43
44 buildForm() { 44 buildForm () {
45 this.form = this.formBuilder.group({ 45 this.form = this.formBuilder.group({
46 username: [ '', USER_USERNAME.VALIDATORS ], 46 username: [ '', USER_USERNAME.VALIDATORS ],
47 email: [ '', USER_EMAIL.VALIDATORS ], 47 email: [ '', USER_EMAIL.VALIDATORS ],
48 password: [ '', USER_PASSWORD.VALIDATORS ], 48 password: [ '', USER_PASSWORD.VALIDATORS ]
49 }); 49 })
50 50
51 this.form.valueChanges.subscribe(data => this.onValueChanged(data)); 51 this.form.valueChanges.subscribe(data => this.onValueChanged(data))
52 } 52 }
53 53
54 ngOnInit() { 54 ngOnInit () {
55 this.buildForm(); 55 this.buildForm()
56 } 56 }
57 57
58 signup() { 58 signup () {
59 this.error = null; 59 this.error = null
60 60
61 const { username, password, email } = this.form.value; 61 const { username, password, email } = this.form.value
62 62
63 this.userService.signup(username, password, email).subscribe( 63 this.userService.signup(username, password, email).subscribe(
64 () => { 64 () => {
65 this.notificationsService.success('Success', `Registration for ${username} complete.`); 65 this.notificationsService.success('Success', `Registration for ${username} complete.`)
66 this.router.navigate([ '/videos/list' ]); 66 this.router.navigate([ '/videos/list' ])
67 }, 67 },
68 68
69 err => this.error = err.text 69 err => this.error = err.text
70 ); 70 )
71 } 71 }
72} 72}
diff --git a/client/src/app/signup/signup.module.ts b/client/src/app/signup/signup.module.ts
index acb7e5515..61560ddcf 100644
--- a/client/src/app/signup/signup.module.ts
+++ b/client/src/app/signup/signup.module.ts
@@ -1,8 +1,8 @@
1import { NgModule } from '@angular/core'; 1import { NgModule } from '@angular/core'
2 2
3import { SignupRoutingModule } from './signup-routing.module'; 3import { SignupRoutingModule } from './signup-routing.module'
4import { SignupComponent } from './signup.component'; 4import { SignupComponent } from './signup.component'
5import { SharedModule } from '../shared'; 5import { SharedModule } from '../shared'
6 6
7@NgModule({ 7@NgModule({
8 imports: [ 8 imports: [