aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/users/user-add/user-add.component.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-02-18 09:29:59 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-02-18 09:29:59 +0100
commitad4a8a1cca1049f600ebcdce9260c1021cd821a5 (patch)
treeca8ffba899b024d56d1bd7846f61aecae0821c82 /client/src/app/+admin/users/user-add/user-add.component.ts
parent5d67f289df4a68e35ad7e0af3c601c7db0dc7586 (diff)
downloadPeerTube-ad4a8a1cca1049f600ebcdce9260c1021cd821a5.tar.gz
PeerTube-ad4a8a1cca1049f600ebcdce9260c1021cd821a5.tar.zst
PeerTube-ad4a8a1cca1049f600ebcdce9260c1021cd821a5.zip
Add email to users
Diffstat (limited to 'client/src/app/+admin/users/user-add/user-add.component.ts')
-rw-r--r--client/src/app/+admin/users/user-add/user-add.component.ts14
1 files changed, 11 insertions, 3 deletions
diff --git a/client/src/app/+admin/users/user-add/user-add.component.ts b/client/src/app/+admin/users/user-add/user-add.component.ts
index a851fee44..f1d2fde80 100644
--- a/client/src/app/+admin/users/user-add/user-add.component.ts
+++ b/client/src/app/+admin/users/user-add/user-add.component.ts
@@ -5,7 +5,12 @@ import { Router } from '@angular/router';
5import { NotificationsService } from 'angular2-notifications'; 5import { NotificationsService } from 'angular2-notifications';
6 6
7import { UserService } from '../shared'; 7import { UserService } from '../shared';
8import { FormReactive, USER_USERNAME, USER_PASSWORD } from '../../../shared'; 8import {
9 FormReactive,
10 USER_USERNAME,
11 USER_EMAIL,
12 USER_PASSWORD
13} from '../../../shared';
9 14
10@Component({ 15@Component({
11 selector: 'my-user-add', 16 selector: 'my-user-add',
@@ -17,10 +22,12 @@ export class UserAddComponent extends FormReactive implements OnInit {
17 form: FormGroup; 22 form: FormGroup;
18 formErrors = { 23 formErrors = {
19 'username': '', 24 'username': '',
25 'email': '',
20 'password': '' 26 'password': ''
21 }; 27 };
22 validationMessages = { 28 validationMessages = {
23 'username': USER_USERNAME.MESSAGES, 29 'username': USER_USERNAME.MESSAGES,
30 'email': USER_EMAIL.MESSAGES,
24 'password': USER_PASSWORD.MESSAGES, 31 'password': USER_PASSWORD.MESSAGES,
25 }; 32 };
26 33
@@ -36,6 +43,7 @@ export class UserAddComponent extends FormReactive implements OnInit {
36 buildForm() { 43 buildForm() {
37 this.form = this.formBuilder.group({ 44 this.form = this.formBuilder.group({
38 username: [ '', USER_USERNAME.VALIDATORS ], 45 username: [ '', USER_USERNAME.VALIDATORS ],
46 email: [ '', USER_EMAIL.VALIDATORS ],
39 password: [ '', USER_PASSWORD.VALIDATORS ], 47 password: [ '', USER_PASSWORD.VALIDATORS ],
40 }); 48 });
41 49
@@ -49,9 +57,9 @@ export class UserAddComponent extends FormReactive implements OnInit {
49 addUser() { 57 addUser() {
50 this.error = null; 58 this.error = null;
51 59
52 const { username, password } = this.form.value; 60 const { username, password, email } = this.form.value;
53 61
54 this.userService.addUser(username, password).subscribe( 62 this.userService.addUser(username, password, email).subscribe(
55 () => { 63 () => {
56 this.notificationsService.success('Success', `User ${username} created.`); 64 this.notificationsService.success('Success', `User ${username} created.`);
57 this.router.navigate([ '/admin/users/list' ]); 65 this.router.navigate([ '/admin/users/list' ]);