Skip to content

Commit 71258ae

Browse files
committed
fix: browser history for change password dialog
* There was a bug during the process of changing password - when user is in the dialog and finish the it by clicking on Cancel or Confirm, then the browser back button behaves incorrectly.
1 parent f3238e7 commit 71258ae

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

libs/perun/components/src/lib/password-reset/password-reset.component.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,19 @@ export class PasswordResetComponent implements OnInit {
9595

9696
const dialogRef = this.dialog.open(ChangePasswordDialogComponent, config);
9797

98-
dialogRef.afterClosed().subscribe(() => {
99-
void this.router.navigate([], {
100-
queryParams: {
101-
namespace: null,
102-
},
103-
queryParamsHandling: 'merge',
104-
});
98+
dialogRef.afterClosed().subscribe((state) => {
99+
if (state === undefined) {
100+
// closed by browser back button
101+
void this.router.navigate([], {
102+
queryParams: {
103+
namespace: null,
104+
},
105+
queryParamsHandling: 'merge',
106+
});
107+
} else {
108+
// Confirmed or Closed by buttons
109+
window.history.back();
110+
}
105111
});
106112
}
107113
}

0 commit comments

Comments
 (0)