diff --git a/.env b/.env index 6bc494f80..2c6ed7fcc 100644 --- a/.env +++ b/.env @@ -7,6 +7,8 @@ DISCOVERY_API_BASE_URL='' ECOMMERCE_BASE_URL='' ENABLE_DEMOGRAPHICS_COLLECTION='' FAVICON_URL='' +ACCOUNT_SETTINGS_URL='' +ACCOUNT_PROFILE_URL='' LANGUAGE_PREFERENCE_COOKIE_NAME='' LMS_BASE_URL='' LOGIN_URL='' diff --git a/.env.development b/.env.development index b9ef17d51..3f6ded955 100644 --- a/.env.development +++ b/.env.development @@ -6,6 +6,8 @@ DEMOGRAPHICS_BASE_URL='http://localhost:18360' DISCOVERY_API_BASE_URL='' ECOMMERCE_BASE_URL='http://localhost:18130' ENABLE_DEMOGRAPHICS_COLLECTION='' +ACCOUNT_SETTINGS_URL=http://localhost:1997 +ACCOUNT_PROFILE_URL=http://localhost:1995 FAVICON_URL=https://edx-cdn.org/v3/default/favicon.ico LANGUAGE_PREFERENCE_COOKIE_NAME='openedx-language-preference' LMS_BASE_URL='http://localhost:18000' diff --git a/.env.test b/.env.test index ea283c0b5..a94e82432 100644 --- a/.env.test +++ b/.env.test @@ -4,6 +4,8 @@ CREDENTIALS_BASE_URL='http://localhost:18150' CSRF_TOKEN_API_PATH='/csrf/api/v1/token' DEMOGRAPHICS_BASE_URL='http://localhost:18360' DISCOVERY_API_BASE_URL='' +ACCOUNT_SETTINGS_URL='http://localhost:1997' +ACCOUNT_PROFILE_URL='http://localhost:1995' ECOMMERCE_BASE_URL='http://localhost:18130' ENABLE_DEMOGRAPHICS_COLLECTION='' FAVICON_URL=https://edx-cdn.org/v3/default/favicon.ico diff --git a/src/account-settings/name-change/NameChange.jsx b/src/account-settings/name-change/NameChange.jsx index 35bbda484..1235c2a5c 100644 --- a/src/account-settings/name-change/NameChange.jsx +++ b/src/account-settings/name-change/NameChange.jsx @@ -69,7 +69,7 @@ const NameChangeModal = ({ useEffect(() => { if (saveState === 'complete') { handleClose(); - navigate(`/id-verification?next=${encodeURIComponent('account/settings')}`); + navigate(`/id-verification?next=${encodeURIComponent('/')}`); } }, [handleClose, navigate, saveState]); diff --git a/src/hooks.js b/src/hooks.js index 6d3feca3e..9eabe4344 100644 --- a/src/hooks.js +++ b/src/hooks.js @@ -36,17 +36,20 @@ export function useAsyncCall(asyncFunc) { export function useRedirect() { const [redirect, setRedirect] = useState({ location: 'dashboard', + isAccountMFERedirect: false, text: 'id.verification.return.dashboard', }); useEffect(() => { if (sessionStorage.getItem('courseId')) { setRedirect({ + isAccountMFERedirect: false, location: `courses/${sessionStorage.getItem('courseId')}`, text: 'id.verification.return.course', }); } else if (sessionStorage.getItem('next')) { setRedirect({ + isAccountMFERedirect: true, location: sessionStorage.getItem('next'), text: 'id.verification.return.generic', }); diff --git a/src/id-verification/panels/SubmittedPanel.jsx b/src/id-verification/panels/SubmittedPanel.jsx index 6397e07d3..a6aa786b6 100644 --- a/src/id-verification/panels/SubmittedPanel.jsx +++ b/src/id-verification/panels/SubmittedPanel.jsx @@ -12,8 +12,9 @@ import BasePanel from './BasePanel'; const SubmittedPanel = (props) => { const { userId } = useContext(IdVerificationContext); - const { location: returnUrl, text: returnText } = useRedirect(); + const { location: returnUrl, text: returnText, isAccountMFERedirect } = useRedirect(); const panelSlug = 'submitted'; + const URL = isAccountMFERedirect ? returnUrl : `${getConfig().LMS_BASE_URL}/${returnUrl}`; useEffect(() => { sendTrackEvent('edx.id_verification.submitted', { @@ -32,7 +33,7 @@ const SubmittedPanel = (props) => {
{props.intl.formatMessage(messages[returnText])} diff --git a/src/id-verification/tests/panels/SubmittedPanel.test.jsx b/src/id-verification/tests/panels/SubmittedPanel.test.jsx index 215e312f3..21ace0045 100644 --- a/src/id-verification/tests/panels/SubmittedPanel.test.jsx +++ b/src/id-verification/tests/panels/SubmittedPanel.test.jsx @@ -82,6 +82,6 @@ describe('SubmittedPanel', () => { ))); const button = await screen.findByTestId('return-button'); expect(button).toHaveTextContent(/Return/); - expect(button).toHaveAttribute('href', `${process.env.LMS_BASE_URL}/some_page`); + expect(button).toHaveAttribute('href', 'some_page'); }); });