diff --git a/src/MistoxWebsite.Client/src/app/pages/account/forgotpassword/forgotpassword.component.ts b/src/MistoxWebsite.Client/src/app/pages/account/forgotpassword/forgotpassword.component.ts index 70b289c..be274d2 100644 --- a/src/MistoxWebsite.Client/src/app/pages/account/forgotpassword/forgotpassword.component.ts +++ b/src/MistoxWebsite.Client/src/app/pages/account/forgotpassword/forgotpassword.component.ts @@ -1,4 +1,4 @@ -import { Component } from '@angular/core'; +import { ChangeDetectorRef, Component } from '@angular/core'; import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'; import { FormsModule } from '@angular/forms'; import { Router, ActivatedRoute } from '@angular/router'; @@ -15,7 +15,7 @@ export class ForgotPasswordComponent { errorMsgs: string[] = []; returnURL: string = '/'; - constructor( private http: HttpClient, private router: Router, private route: ActivatedRoute, private title: Title ) { + constructor( private http: HttpClient, private router: Router, private route: ActivatedRoute, private title: Title, private changeDetector: ChangeDetectorRef ) { this.title.setTitle("Forgot Password | Mistox"); this.route.queryParams.subscribe(params => { this.returnURL = params['returnURL'] || '/'; @@ -41,11 +41,12 @@ export class ForgotPasswordComponent { next: async (data) => { if (data.trim() == "Success"){ this.errorMsgs = ["Reset password send"]; + this.changeDetector.detectChanges(); await this.sleep(3000); this.router.navigate([this.returnURL]); }else{ - this.errorMsgs = []; - this.errorMsgs.push(data); + this.errorMsgs = [data]; + this.changeDetector.detectChanges(); } }, error: err => { diff --git a/src/MistoxWebsite.Client/src/app/pages/account/resetpassword/resetpassword.component.ts b/src/MistoxWebsite.Client/src/app/pages/account/resetpassword/resetpassword.component.ts index 1edcce0..34fe22e 100644 --- a/src/MistoxWebsite.Client/src/app/pages/account/resetpassword/resetpassword.component.ts +++ b/src/MistoxWebsite.Client/src/app/pages/account/resetpassword/resetpassword.component.ts @@ -1,4 +1,4 @@ -import { Component } from '@angular/core'; +import { ChangeDetectorRef, Component } from '@angular/core'; import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'; import { FormsModule } from '@angular/forms'; import { Router, ActivatedRoute } from '@angular/router'; @@ -19,7 +19,7 @@ export class ResetPasswordComponent { errorMsgs: string[] = []; - constructor( private http: HttpClient, private router: Router, private route: ActivatedRoute, private title: Title ) { + constructor( private http: HttpClient, private router: Router, private route: ActivatedRoute, private title: Title, private changeDetector: ChangeDetectorRef ) { this.title.setTitle("Reset Password | Mistox"); this.route.queryParams.subscribe(params => { this.UserName = params['UserName'] || ''; @@ -54,10 +54,12 @@ export class ResetPasswordComponent { next: async (data) => { if (data == true){ this.errorMsgs = ["Password reset successfully"]; + this.changeDetector.detectChanges(); await this.sleep(3000); this.router.navigate(["/account/login"]); }else{ this.errorMsgs = ["An error has ocurred"]; + this.changeDetector.detectChanges(); await this.sleep(3000); this.router.navigate(["/account/sendresetpassword"]); }