diff options
Diffstat (limited to 'client/src/app/account')
-rw-r--r-- | client/src/app/account/account.component.html | 1 | ||||
-rw-r--r-- | client/src/app/account/account.component.ts | 12 |
2 files changed, 6 insertions, 7 deletions
diff --git a/client/src/app/account/account.component.html b/client/src/app/account/account.component.html index 5a8847acd..2fbb5a908 100644 --- a/client/src/app/account/account.component.html +++ b/client/src/app/account/account.component.html | |||
@@ -1,6 +1,5 @@ | |||
1 | <h3>Account</h3> | 1 | <h3>Account</h3> |
2 | 2 | ||
3 | <div *ngIf="information" class="alert alert-success">{{ information }}</div> | ||
4 | <div *ngIf="error" class="alert alert-danger">{{ error }}</div> | 3 | <div *ngIf="error" class="alert alert-danger">{{ error }}</div> |
5 | 4 | ||
6 | <form role="form" (ngSubmit)="changePassword()" [formGroup]="form"> | 5 | <form role="form" (ngSubmit)="changePassword()" [formGroup]="form"> |
diff --git a/client/src/app/account/account.component.ts b/client/src/app/account/account.component.ts index 851eaf198..9b6b5fbf4 100644 --- a/client/src/app/account/account.component.ts +++ b/client/src/app/account/account.component.ts | |||
@@ -1,8 +1,9 @@ | |||
1 | import { } from '@angular/common'; | ||
2 | import { Component, OnInit } from '@angular/core'; | 1 | import { Component, OnInit } from '@angular/core'; |
3 | import { FormBuilder, FormGroup } from '@angular/forms'; | 2 | import { FormBuilder, FormGroup } from '@angular/forms'; |
4 | import { Router } from '@angular/router'; | 3 | import { Router } from '@angular/router'; |
5 | 4 | ||
5 | import { NotificationsService } from 'angular2-notifications'; | ||
6 | |||
6 | import { AccountService } from './account.service'; | 7 | import { AccountService } from './account.service'; |
7 | import { FormReactive, USER_PASSWORD } from '../shared'; | 8 | import { FormReactive, USER_PASSWORD } from '../shared'; |
8 | 9 | ||
@@ -12,7 +13,6 @@ import { FormReactive, USER_PASSWORD } from '../shared'; | |||
12 | }) | 13 | }) |
13 | 14 | ||
14 | export class AccountComponent extends FormReactive implements OnInit { | 15 | export class AccountComponent extends FormReactive implements OnInit { |
15 | information: string = null; | ||
16 | error: string = null; | 16 | error: string = null; |
17 | 17 | ||
18 | form: FormGroup; | 18 | form: FormGroup; |
@@ -26,9 +26,10 @@ export class AccountComponent extends FormReactive implements OnInit { | |||
26 | }; | 26 | }; |
27 | 27 | ||
28 | constructor( | 28 | constructor( |
29 | private accountService: AccountService, | ||
30 | private formBuilder: FormBuilder, | 29 | private formBuilder: FormBuilder, |
31 | private router: Router | 30 | private router: Router, |
31 | private notificationsService: NotificationsService, | ||
32 | private accountService: AccountService | ||
32 | ) { | 33 | ) { |
33 | super(); | 34 | super(); |
34 | } | 35 | } |
@@ -50,7 +51,6 @@ export class AccountComponent extends FormReactive implements OnInit { | |||
50 | const newPassword = this.form.value['new-password']; | 51 | const newPassword = this.form.value['new-password']; |
51 | const newConfirmedPassword = this.form.value['new-confirmed-password']; | 52 | const newConfirmedPassword = this.form.value['new-confirmed-password']; |
52 | 53 | ||
53 | this.information = null; | ||
54 | this.error = null; | 54 | this.error = null; |
55 | 55 | ||
56 | if (newPassword !== newConfirmedPassword) { | 56 | if (newPassword !== newConfirmedPassword) { |
@@ -59,7 +59,7 @@ export class AccountComponent extends FormReactive implements OnInit { | |||
59 | } | 59 | } |
60 | 60 | ||
61 | this.accountService.changePassword(newPassword).subscribe( | 61 | this.accountService.changePassword(newPassword).subscribe( |
62 | ok => this.information = 'Password updated.', | 62 | () => this.notificationsService.success('Success', 'Password updated.'), |
63 | 63 | ||
64 | err => this.error = err | 64 | err => this.error = err |
65 | ); | 65 | ); |