Fix: Frontend password reset token parsing and routing

This commit addresses the issue where the password reset page was not displayed correctly after clicking the reset link in the email.

- ****:
    - **Reset Token Parsing**: Changed the logic in the  function to extract the  from  instead of . The reset links send the token as part of the URL fragment, which  would not capture.
    - **View Routing Condition**: Updated the conditional checks for displaying the  to use  instead of a strict equality check (). This ensures that the view is correctly triggered when the hash contains additional query parameters, such as the reset token.

These changes ensure that users are correctly directed to the password reset form when they click the email link, allowing them to complete the password reset process.
This commit is contained in:
2025-12-23 23:31:59 +01:00
parent 5b1a89d30a
commit 075662a8ad

View File

@@ -2399,13 +2399,17 @@
// Handle routing based on URL hash
const hash = window.location.hash;
const urlParams = new URLSearchParams(window.location.search);
const resetToken = urlParams.get('token');
let resetToken = null;
if (hash.includes('reset-password') && hash.includes('?token=')) {
resetToken = hash.split('?token=')[1];
}
if (localStorage.getItem('access_token')) {
// If logged in, check if there's a reset token in URL
if (hash === '#reset-password' && resetToken) {
if (hash.startsWith('#reset-password') && resetToken) {
showResetPasswordView(resetToken);
} else {
showAppView();
@@ -2414,7 +2418,7 @@
// Not logged in
if (hash === '#forgot-password') {
showForgotPasswordView();
} else if (hash === '#reset-password' && resetToken) {
} else if (hash.startsWith('#reset-password') && resetToken) {
showResetPasswordView(resetToken);
}
else {