From 3fcf7dea0793bb54282086c04f2aa0ee675ad08b Mon Sep 17 00:00:00 2001 From: mubbsharanwar Date: Tue, 20 Aug 2024 18:53:39 +0500 Subject: [PATCH] fix: password reset redirection fix authenticated user redirects to 404 if token is invalide for password reset VAN-2052 --- src/common-components/UnAuthOnlyRoute.jsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/common-components/UnAuthOnlyRoute.jsx b/src/common-components/UnAuthOnlyRoute.jsx index 3e05fe0b..2e9df557 100644 --- a/src/common-components/UnAuthOnlyRoute.jsx +++ b/src/common-components/UnAuthOnlyRoute.jsx @@ -4,6 +4,7 @@ import { getConfig } from '@edx/frontend-platform'; import { fetchAuthenticatedUser, getAuthenticatedUser } from '@edx/frontend-platform/auth'; import PropTypes from 'prop-types'; +import { RESET_PAGE } from '../data/constants'; import { updatePathWithQueryParams } from '../data/utils'; /** @@ -24,6 +25,10 @@ const UnAuthOnlyRoute = ({ children }) => { if (isReady) { if (authUser && authUser.username) { const updatedPath = updatePathWithQueryParams(window.location.pathname); + if (updatedPath.startsWith(RESET_PAGE)) { + global.location.href = getConfig().LMS_BASE_URL; + return null; + } global.location.href = getConfig().LMS_BASE_URL.concat(updatedPath); return null; }