diff options
Diffstat (limited to 'client/src/app/+admin')
4 files changed, 27 insertions, 4 deletions
diff --git a/client/src/app/+admin/users/shared/user.service.ts b/client/src/app/+admin/users/shared/user.service.ts index f6d360e09..a92f9c231 100644 --- a/client/src/app/+admin/users/shared/user.service.ts +++ b/client/src/app/+admin/users/shared/user.service.ts | |||
@@ -14,9 +14,10 @@ export class UserService { | |||
14 | private restExtractor: RestExtractor | 14 | private restExtractor: RestExtractor |
15 | ) {} | 15 | ) {} |
16 | 16 | ||
17 | addUser(username: string, password: string) { | 17 | addUser(username: string, password: string, email: string) { |
18 | const body = { | 18 | const body = { |
19 | username, | 19 | username, |
20 | email, | ||
20 | password | 21 | password |
21 | }; | 22 | }; |
22 | 23 | ||
diff --git a/client/src/app/+admin/users/user-add/user-add.component.html b/client/src/app/+admin/users/user-add/user-add.component.html index 9b76c7c1b..105760f48 100644 --- a/client/src/app/+admin/users/user-add/user-add.component.html +++ b/client/src/app/+admin/users/user-add/user-add.component.html | |||
@@ -15,6 +15,17 @@ | |||
15 | </div> | 15 | </div> |
16 | 16 | ||
17 | <div class="form-group"> | 17 | <div class="form-group"> |
18 | <label for="email">Email</label> | ||
19 | <input | ||
20 | type="text" class="form-control" id="email" placeholder="Email" | ||
21 | formControlName="email" | ||
22 | > | ||
23 | <div *ngIf="formErrors.email" class="alert alert-danger"> | ||
24 | {{ formErrors.email }} | ||
25 | </div> | ||
26 | </div> | ||
27 | |||
28 | <div class="form-group"> | ||
18 | <label for="password">Password</label> | 29 | <label for="password">Password</label> |
19 | <input | 30 | <input |
20 | type="password" class="form-control" id="password" placeholder="Password" | 31 | type="password" class="form-control" id="password" placeholder="Password" |
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'; | |||
5 | import { NotificationsService } from 'angular2-notifications'; | 5 | import { NotificationsService } from 'angular2-notifications'; |
6 | 6 | ||
7 | import { UserService } from '../shared'; | 7 | import { UserService } from '../shared'; |
8 | import { FormReactive, USER_USERNAME, USER_PASSWORD } from '../../../shared'; | 8 | import { |
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' ]); |
diff --git a/client/src/app/+admin/users/user-list/user-list.component.ts b/client/src/app/+admin/users/user-list/user-list.component.ts index c27b96e28..69ae4353d 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.ts +++ b/client/src/app/+admin/users/user-list/user-list.component.ts | |||
@@ -40,6 +40,9 @@ export class UserListComponent { | |||
40 | username: { | 40 | username: { |
41 | title: 'Username' | 41 | title: 'Username' |
42 | }, | 42 | }, |
43 | email: { | ||
44 | title: 'Email' | ||
45 | }, | ||
43 | role: { | 46 | role: { |
44 | title: 'Role', | 47 | title: 'Role', |
45 | sort: false | 48 | sort: false |