From 533f08464818f403728f54fcd3f2bbd2387a94bc Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Tue, 18 Apr 2023 16:41:29 +0300 Subject: [PATCH] UI: Fixed reset password service --- ui-ngx/src/app/core/auth/auth.service.ts | 6 ++---- .../modules/login/pages/login/reset-password.component.ts | 7 +++++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ui-ngx/src/app/core/auth/auth.service.ts b/ui-ngx/src/app/core/auth/auth.service.ts index 3eb596381d..7b5a997804 100644 --- a/ui-ngx/src/app/core/auth/auth.service.ts +++ b/ui-ngx/src/app/core/auth/auth.service.ts @@ -156,10 +156,8 @@ export class AuthService { )); } - public resetPassword(resetToken: string, password: string) { - this.http.post('/api/noauth/resetPassword', {resetToken, password}, defaultHttpOptions()).subscribe( - () => { this.router.navigateByUrl('login'); }, () => {} - ); + public resetPassword(resetToken: string, password: string): Observable { + return this.http.post('/api/noauth/resetPassword', {resetToken, password}, defaultHttpOptions()); } public changePassword(currentPassword: string, newPassword: string, config?: RequestConfig) { diff --git a/ui-ngx/src/app/modules/login/pages/login/reset-password.component.ts b/ui-ngx/src/app/modules/login/pages/login/reset-password.component.ts index 73d7da65d4..2857241c27 100644 --- a/ui-ngx/src/app/modules/login/pages/login/reset-password.component.ts +++ b/ui-ngx/src/app/modules/login/pages/login/reset-password.component.ts @@ -22,7 +22,7 @@ import { PageComponent } from '@shared/components/page.component'; import { FormBuilder } from '@angular/forms'; import { ActionNotificationShow } from '@core/notification/notification.actions'; import { TranslateService } from '@ngx-translate/core'; -import { ActivatedRoute } from '@angular/router'; +import { ActivatedRoute, Router } from '@angular/router'; import { Subscription } from 'rxjs'; @Component({ @@ -44,6 +44,7 @@ export class ResetPasswordComponent extends PageComponent implements OnInit, OnD constructor(protected store: Store, private route: ActivatedRoute, + private router: Router, private authService: AuthService, private translate: TranslateService, public fb: FormBuilder) { @@ -71,7 +72,9 @@ export class ResetPasswordComponent extends PageComponent implements OnInit, OnD } else { this.authService.resetPassword( this.resetToken, - this.resetPassword.get('newPassword').value); + this.resetPassword.get('newPassword').value).subscribe( + () => this.router.navigateByUrl('login') + ); } } }