From 142553d3b6c4d1d5629db03d68db526c066bbe07 Mon Sep 17 00:00:00 2001 From: FlayInAHook Date: Thu, 3 Dec 2020 11:13:03 +0100 Subject: [PATCH] changed pw reset behavior --- src/app/pages/login/login.component.html | 2 +- src/app/pages/login/login.component.ts | 1 + src/app/pages/profile/profile.component.ts | 10 ++++++++-- src/app/services/auth.service.ts | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/app/pages/login/login.component.html b/src/app/pages/login/login.component.html index 119f960..29f2c04 100644 --- a/src/app/pages/login/login.component.html +++ b/src/app/pages/login/login.component.html @@ -12,7 +12,7 @@ - Passwort eingebene + Passwort eingeben this.router.navigateByUrl(this.returnUrl), (error) => { + console.log(JSON.stringify(error)); this.errorOccurred = true; this.errorMessage = error.error.message || diff --git a/src/app/pages/profile/profile.component.ts b/src/app/pages/profile/profile.component.ts index bf23833..3ea5a54 100644 --- a/src/app/pages/profile/profile.component.ts +++ b/src/app/pages/profile/profile.component.ts @@ -61,17 +61,23 @@ export class ProfileComponent implements OnInit { user.password = this.passwordNew.value; this.loading = true; - this.userService + this.authService.refreshToken().subscribe( + () => { + this.userService .updateUser(user) .subscribe( data => { this.snackBar.openSnackBar("Das Passwort wurde erfolgreich aktualisiert", "Ok"); - console.log(JSON.stringify(data)); + this.password.reset(); + this.pwGroup.reset(); } ) .add(() => { this.loading = false; }); + } + ) + } } diff --git a/src/app/services/auth.service.ts b/src/app/services/auth.service.ts index aab18d8..a77a8ba 100644 --- a/src/app/services/auth.service.ts +++ b/src/app/services/auth.service.ts @@ -113,7 +113,7 @@ export class AuthService { this.currentUserSubject.next(usr); } - private removeTokens() { + public removeTokens() { //localStorage.removeItem(this.REQUEST_TOKEN); //localStorage.removeItem(this.REFRESH_TOKEN); localStorage.removeItem(this.CURRENT_USER);