UI: Fixed reset password service
This commit is contained in:
parent
bd81290826
commit
533f084648
@ -156,10 +156,8 @@ export class AuthService {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
public resetPassword(resetToken: string, password: string) {
|
public resetPassword(resetToken: string, password: string): Observable<LoginResponse> {
|
||||||
this.http.post('/api/noauth/resetPassword', {resetToken, password}, defaultHttpOptions()).subscribe(
|
return this.http.post<LoginResponse>('/api/noauth/resetPassword', {resetToken, password}, defaultHttpOptions());
|
||||||
() => { this.router.navigateByUrl('login'); }, () => {}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public changePassword(currentPassword: string, newPassword: string, config?: RequestConfig) {
|
public changePassword(currentPassword: string, newPassword: string, config?: RequestConfig) {
|
||||||
|
|||||||
@ -22,7 +22,7 @@ import { PageComponent } from '@shared/components/page.component';
|
|||||||
import { FormBuilder } from '@angular/forms';
|
import { FormBuilder } from '@angular/forms';
|
||||||
import { ActionNotificationShow } from '@core/notification/notification.actions';
|
import { ActionNotificationShow } from '@core/notification/notification.actions';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { Subscription } from 'rxjs';
|
import { Subscription } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -44,6 +44,7 @@ export class ResetPasswordComponent extends PageComponent implements OnInit, OnD
|
|||||||
|
|
||||||
constructor(protected store: Store<AppState>,
|
constructor(protected store: Store<AppState>,
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
|
private router: Router,
|
||||||
private authService: AuthService,
|
private authService: AuthService,
|
||||||
private translate: TranslateService,
|
private translate: TranslateService,
|
||||||
public fb: FormBuilder) {
|
public fb: FormBuilder) {
|
||||||
@ -71,7 +72,9 @@ export class ResetPasswordComponent extends PageComponent implements OnInit, OnD
|
|||||||
} else {
|
} else {
|
||||||
this.authService.resetPassword(
|
this.authService.resetPassword(
|
||||||
this.resetToken,
|
this.resetToken,
|
||||||
this.resetPassword.get('newPassword').value);
|
this.resetPassword.get('newPassword').value).subscribe(
|
||||||
|
() => this.router.navigateByUrl('login')
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user